aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-15 07:12:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-15 07:12:46 +0000
commit50b1e640c5df1ba948bda5e23b9df6e8e0fb910d (patch)
tree3707cc104faedd746321b86d3dd101e18b60bf13 /test/ruby/test_syntax.rb
parent6b40b69b961a2b2c53389bc2649ed13e9f76012e (diff)
downloadruby-50b1e640c5df1ba948bda5e23b9df6e8e0fb910d.tar.gz
parse.y: should not deent concatenated string
* parse.y (string1): reset heredoc indent fore each string leteral so that concatenated string would not be dedented. [ruby-core:72857] [Bug #11990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 1daf7b2d91..a81e489222 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -580,6 +580,15 @@ e"
assert_dedented_heredoc(expect, result)
end
+ def test_dedented_heredoc_with_concatenation
+ bug11990 = '[ruby-core:72857] [Bug #11990] concatenated string should not be dedented'
+ %w[eos "eos" 'eos'].each do |eos|
+ assert_equal("x\n y",
+ eval("<<~#{eos} ' y'\n x\neos\n"),
+ "#{bug11990} with #{eos}")
+ end
+ end
+
def test_lineno_after_heredoc
bug7559 = '[ruby-dev:46737]'
expected, _, actual = __LINE__, <<eom, __LINE__