@@ -74,7 +74,7 @@ class C; end
7474
7575 comment = parser . collect_first_comment
7676
77- assert_equal RDoc ::Comment . new ( "first \n \n " , @top_level ) , comment
77+ assert_equal RDoc ::Comment . new ( "=begin \n first \n =end \n \n " , @top_level ) , comment
7878 end
7979
8080 def test_get_class_or_module
@@ -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"><<~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</span>
2517+ <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
25042533prefix = 'path'
@@ -2948,11 +2977,11 @@ def m() end
29482977
29492978 foo = @top_level . classes . first
29502979
2951- assert_equal 'Foo comment' , foo . comment . text
2980+ assert_equal "=begin rdoc \n Foo comment\n =end" , foo . comment . text
29522981
29532982 m = foo . method_list . first
29542983
2955- assert_equal 'm comment' , m . comment . text
2984+ assert_equal "=begin \n m comment\n =end" , m . comment . text
29562985 end
29572986
29582987 def test_scan_block_comment_nested # Issue #41
@@ -2974,7 +3003,7 @@ class Bar
29743003 foo = @top_level . modules . first
29753004
29763005 assert_equal 'Foo' , foo . full_name
2977- assert_equal 'findmeindoc' , foo . comment . text
3006+ assert_equal "=begin rdoc \n findmeindoc \n =end" , foo . comment . text
29783007
29793008 bar = foo . classes . first
29803009
@@ -3021,12 +3050,12 @@ def lauren
30213050
30223051 foo = @top_level . classes . first
30233052
3024- assert_equal "= DESCRIPTION\n \n This is a simple test class\n \n = RUMPUS\n \n Is a silly word" ,
3053+ assert_equal "=begin rdoc \n \n = DESCRIPTION\n \n This is a simple test class\n \n = RUMPUS\n \n Is a silly word\n \n =end " ,
30253054 foo . comment . text
30263055
30273056 m = foo . method_list . first
30283057
3029- assert_equal 'A nice girl' , m . comment . text
3058+ assert_equal "=begin rdoc \n A nice girl\n =end" , m . comment . text
30303059 end
30313060
30323061 def test_scan_class_nested_nodoc
0 commit comments