@@ -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
@@ -2513,8 +2513,8 @@ def blah()
25132513 expected = <<EXPTECTED
25142514 <span class="ruby-keyword">def</span> <span class="ruby-identifier">blah</span>()
25152515 <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
2517- </span> <span class="ruby-keyword">end</span>
2516+ <span class="ruby-value"></span><span class="ruby-identifier"> EOM</span>
2517+ <span class="ruby-keyword">end</span>
25182518EXPTECTED
25192519 expected = expected . rstrip
25202520
@@ -2528,6 +2528,40 @@ def blah()
25282528 assert_equal markup_code , expected
25292529 end
25302530
2531+ def test_parse_statements_embdoc_in_document
2532+ @filename = 'file.rb'
2533+ util_parser <<RUBY
2534+ class Foo
2535+ # doc
2536+ #
2537+ # =begin
2538+ # test embdoc
2539+ # =end
2540+ #
2541+ def blah
2542+ end
2543+ end
2544+ RUBY
2545+
2546+ expected = <<EXPTECTED
2547+ <p>doc
2548+
2549+ <pre class="ruby"><span class="ruby-comment">=begin
2550+ test embdoc
2551+ =end</span>
2552+ </pre>
2553+ EXPTECTED
2554+
2555+ @parser . scan
2556+
2557+ foo = @top_level . classes . first
2558+ assert_equal 'Foo' , foo . full_name
2559+
2560+ blah = foo . method_list . first
2561+ markup_comment = blah . search_record [ 6 ]
2562+ assert_equal markup_comment , expected
2563+ end
2564+
25312565 def test_parse_require_dynamic_string
25322566 content = <<-RUBY
25332567prefix = 'path'
@@ -3002,11 +3036,11 @@ def m() end
30023036
30033037 foo = @top_level . classes . first
30043038
3005- assert_equal 'Foo comment' , foo . comment . text
3039+ assert_equal "=begin rdoc \n Foo comment\n =end" , foo . comment . text
30063040
30073041 m = foo . method_list . first
30083042
3009- assert_equal 'm comment' , m . comment . text
3043+ assert_equal "=begin \n m comment\n =end" , m . comment . text
30103044 end
30113045
30123046 def test_scan_block_comment_nested # Issue #41
@@ -3028,7 +3062,7 @@ class Bar
30283062 foo = @top_level . modules . first
30293063
30303064 assert_equal 'Foo' , foo . full_name
3031- assert_equal 'findmeindoc' , foo . comment . text
3065+ assert_equal "=begin rdoc \n findmeindoc \n =end" , foo . comment . text
30323066
30333067 bar = foo . classes . first
30343068
@@ -3075,12 +3109,12 @@ def lauren
30753109
30763110 foo = @top_level . classes . first
30773111
3078- assert_equal "= DESCRIPTION\n \n This is a simple test class\n \n = RUMPUS\n \n Is a silly word" ,
3112+ 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 " ,
30793113 foo . comment . text
30803114
30813115 m = foo . method_list . first
30823116
3083- assert_equal 'A nice girl' , m . comment . text
3117+ assert_equal "=begin rdoc \n A nice girl\n =end" , m . comment . text
30843118 end
30853119
30863120 def test_scan_class_nested_nodoc
0 commit comments