Skip to content

Commit 0617472

Browse files
committed
Add test_parse_statements_postfix_if_after_heredocbeg
1 parent 72e5ee4 commit 0617472

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test_rdoc_parser_ruby.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,35 @@ def blah()
24992499
assert_equal markup_code, expected
25002500
end
25012501

2502+
def test_parse_statements_postfix_if_after_heredocbeg
2503+
@filename = 'file.rb'
2504+
util_parser <<RUBY
2505+
class Foo
2506+
def blah()
2507+
<<~EOM if true
2508+
EOM
2509+
end
2510+
end
2511+
RUBY
2512+
2513+
expected = <<EXPTECTED
2514+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">blah</span>()
2515+
<span class="ruby-identifier">&lt;&lt;~EOM</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">true</span>
2516+
<span class="ruby-value"></span><span class="ruby-identifier"> EOM
2517+
</span> <span class="ruby-keyword">end</span>
2518+
EXPTECTED
2519+
expected = expected.rstrip
2520+
2521+
@parser.scan
2522+
2523+
foo = @top_level.classes.first
2524+
assert_equal 'Foo', foo.full_name
2525+
2526+
blah = foo.method_list.first
2527+
markup_code = blah.markup_code.sub(/^.*\n/, '')
2528+
assert_equal markup_code, expected
2529+
end
2530+
25022531
def test_parse_require_dynamic_string
25032532
content = <<-RUBY
25042533
prefix = 'path'

0 commit comments

Comments
 (0)