@@ -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
@@ -2499,6 +2499,35 @@ def blah()
2499
2499
assert_equal markup_code , expected
2500
2500
end
2501
2501
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
+
2502
2531
def test_parse_require_dynamic_string
2503
2532
content = <<-RUBY
2504
2533
prefix = 'path'
@@ -2948,11 +2977,11 @@ def m() end
2948
2977
2949
2978
foo = @top_level . classes . first
2950
2979
2951
- assert_equal 'Foo comment' , foo . comment . text
2980
+ assert_equal "=begin rdoc \n Foo comment\n =end" , foo . comment . text
2952
2981
2953
2982
m = foo . method_list . first
2954
2983
2955
- assert_equal 'm comment' , m . comment . text
2984
+ assert_equal "=begin \n m comment\n =end" , m . comment . text
2956
2985
end
2957
2986
2958
2987
def test_scan_block_comment_nested # Issue #41
@@ -2974,7 +3003,7 @@ class Bar
2974
3003
foo = @top_level . modules . first
2975
3004
2976
3005
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
2978
3007
2979
3008
bar = foo . classes . first
2980
3009
@@ -3021,12 +3050,12 @@ def lauren
3021
3050
3022
3051
foo = @top_level . classes . first
3023
3052
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 " ,
3025
3054
foo . comment . text
3026
3055
3027
3056
m = foo . method_list . first
3028
3057
3029
- assert_equal 'A nice girl' , m . comment . text
3058
+ assert_equal "=begin rdoc \n A nice girl\n =end" , m . comment . text
3030
3059
end
3031
3060
3032
3061
def test_scan_class_nested_nodoc
0 commit comments