File tree 2 files changed +33
-0
lines changed 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -555,6 +555,10 @@ def get_squashed_tk
555
555
tk [ :text ] += tk_ahead [ :text ]
556
556
tk [ :kind ] = tk_ahead [ :kind ]
557
557
tk [ :state ] = tk_ahead [ :state ]
558
+ when :on_heredoc_beg , :on_tstring , :on_dstring # frozen/non-frozen string literal
559
+ tk [ :text ] += tk_ahead [ :text ]
560
+ tk [ :kind ] = tk_ahead [ :kind ]
561
+ tk [ :state ] = tk_ahead [ :state ]
558
562
else
559
563
@buf . unshift tk_ahead
560
564
end
Original file line number Diff line number Diff line change @@ -2848,6 +2848,35 @@ def blah()
2848
2848
assert_equal expected , markup_code
2849
2849
end
2850
2850
2851
+ def test_parse_mutable_heredocbeg
2852
+ @filename = 'file.rb'
2853
+ util_parser <<RUBY
2854
+ class Foo
2855
+ def blah()
2856
+ @str = -<<-EOM
2857
+ EOM
2858
+ end
2859
+ end
2860
+ RUBY
2861
+
2862
+ expected = <<EXPECTED
2863
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">blah</span>()
2864
+ <span class="ruby-ivar">@str</span> = <span class="ruby-identifier">-<<-EOM</span>
2865
+ <span class="ruby-value"></span><span class="ruby-identifier"> EOM</span>
2866
+ <span class="ruby-keyword">end</span>
2867
+ EXPECTED
2868
+ expected = expected . rstrip
2869
+
2870
+ @parser . scan
2871
+
2872
+ foo = @top_level . classes . first
2873
+ assert_equal 'Foo' , foo . full_name
2874
+
2875
+ blah = foo . method_list . first
2876
+ markup_code = blah . markup_code . sub ( /^.*\n / , '' )
2877
+ assert_equal expected , markup_code
2878
+ end
2879
+
2851
2880
def test_parse_statements_method_oneliner_with_regexp
2852
2881
util_parser <<RUBY
2853
2882
class Foo
You can’t perform that action at this time.
0 commit comments