Skip to content

Add test for postfix if/unless/while/until #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/test_rdoc_parser_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,30 @@ def blah
assert_equal 'Foo#blah', methods.first.full_name
end

def test_parse_statements_postfix_if_unless
util_parser <<-CODE
class C
def foo
1 if nil
end

def bar
2 unless nil
end
end
CODE

@parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil

c = @top_level.classes.first
assert_equal 'C', c.full_name, 'class C'

methods = c.method_list
assert_equal 2, methods.length
assert_equal 'C#foo', methods[0].full_name
assert_equal 'C#bar', methods[1].full_name
end

def test_parse_statements_class_nested
comment = RDoc::Comment.new "##\n# my method\n", @top_level

Expand Down