File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments