File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -785,8 +785,14 @@ def visit_string_concat_node(node)
785
785
end
786
786
end
787
787
left
788
+ when %i[ str dstr ]
789
+ right [ 1 ] = left [ 1 ] + right [ 1 ]
790
+ right
791
+ when %i[ dstr str ]
792
+ left << right
793
+ left
788
794
else
789
- debug node
795
+ raise SyntaxError , "Unexpected nodes for StringConcatNode: #{ left . inspect } and #{ right . inspect } "
790
796
end
791
797
end
792
798
Original file line number Diff line number Diff line change @@ -758,4 +758,19 @@ def initialize(s)
758
758
"a\n b\n c" . each_line ( chomp : true ) . to_a . should == %w[ a b c ]
759
759
end
760
760
end
761
+
762
+ describe 'line continuation' do
763
+ s = 'foo' \
764
+ 'bar'
765
+ s . should == 'foobar'
766
+ s = 'foo' \
767
+ "bar#{ 1 + 1 } "
768
+ s . should == 'foobar2'
769
+ s = "foo#{ 1 + 1 } " \
770
+ "bar#{ 1 + 1 } "
771
+ s . should == 'foo2bar2'
772
+ s = "foo#{ 1 + 1 } " \
773
+ 'bar'
774
+ s . should == 'foo2bar'
775
+ end
761
776
end
You can’t perform that action at this time.
0 commit comments