@@ -74,7 +74,7 @@ class C; end
74
74
75
75
comment = parser . collect_first_comment
76
76
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
78
78
end
79
79
80
80
def test_get_class_or_module
@@ -2513,8 +2513,8 @@ def blah()
2513
2513
expected = <<EXPTECTED
2514
2514
<span class="ruby-keyword">def</span> <span class="ruby-identifier">blah</span>()
2515
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
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>
2518
2518
EXPTECTED
2519
2519
expected = expected . rstrip
2520
2520
@@ -2528,6 +2528,40 @@ def blah()
2528
2528
assert_equal markup_code , expected
2529
2529
end
2530
2530
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
+
2531
2565
def test_parse_require_dynamic_string
2532
2566
content = <<-RUBY
2533
2567
prefix = 'path'
@@ -3002,11 +3036,11 @@ def m() end
3002
3036
3003
3037
foo = @top_level . classes . first
3004
3038
3005
- assert_equal 'Foo comment' , foo . comment . text
3039
+ assert_equal "=begin rdoc \n Foo comment\n =end" , foo . comment . text
3006
3040
3007
3041
m = foo . method_list . first
3008
3042
3009
- assert_equal 'm comment' , m . comment . text
3043
+ assert_equal "=begin \n m comment\n =end" , m . comment . text
3010
3044
end
3011
3045
3012
3046
def test_scan_block_comment_nested # Issue #41
@@ -3028,7 +3062,7 @@ class Bar
3028
3062
foo = @top_level . modules . first
3029
3063
3030
3064
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
3032
3066
3033
3067
bar = foo . classes . first
3034
3068
@@ -3075,12 +3109,12 @@ def lauren
3075
3109
3076
3110
foo = @top_level . classes . first
3077
3111
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 " ,
3079
3113
foo . comment . text
3080
3114
3081
3115
m = foo . method_list . first
3082
3116
3083
- assert_equal 'A nice girl' , m . comment . text
3117
+ assert_equal "=begin rdoc \n A nice girl\n =end" , m . comment . text
3084
3118
end
3085
3119
3086
3120
def test_scan_class_nested_nodoc
0 commit comments