Skip to content

Commit f72c753

Browse files
author
Zachary Scott
authored
Merge pull request #460 from aycabta/add-test-for-postfix-if
Add test for postfix if/unless/while/until
2 parents 35141c8 + 1bb05a9 commit f72c753

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/test_rdoc_parser_ruby.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,30 @@ def blah
20232023
assert_equal 'Foo#blah', methods.first.full_name
20242024
end
20252025

2026+
def test_parse_statements_postfix_if_unless
2027+
util_parser <<-CODE
2028+
class C
2029+
def foo
2030+
1 if nil
2031+
end
2032+
2033+
def bar
2034+
2 unless nil
2035+
end
2036+
end
2037+
CODE
2038+
2039+
@parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil
2040+
2041+
c = @top_level.classes.first
2042+
assert_equal 'C', c.full_name, 'class C'
2043+
2044+
methods = c.method_list
2045+
assert_equal 2, methods.length
2046+
assert_equal 'C#foo', methods[0].full_name
2047+
assert_equal 'C#bar', methods[1].full_name
2048+
end
2049+
20262050
def test_parse_statements_class_nested
20272051
comment = RDoc::Comment.new "##\n# my method\n", @top_level
20282052

0 commit comments

Comments
 (0)