aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-16 12:16:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-16 12:16:59 +0000
commit621a6fe61afecfb26b453779e127860dfe897662 (patch)
tree96e0c89ade172375372a6ddebb58158c201b6750 /test/ruby/test_syntax.rb
parent7fc586f7d769dbe797673b8d688a5a7b36870c31 (diff)
downloadruby-621a6fe61afecfb26b453779e127860dfe897662.tar.gz
parse.y: should not deent concatenated string
* parse.y (xstring): reset heredoc indent after dedenting, so that following string literal would not be dedented. [ruby-core:72857] [Bug #11990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index a81e489222..b7f001e2f0 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -2,6 +2,14 @@
require 'test/unit'
class TestSyntax < Test::Unit::TestCase
+ using Module.new {
+ refine(Object) do
+ def `(s) #`
+ s
+ end
+ end
+ }
+
def assert_syntax_files(test)
srcdir = File.expand_path("../../..", __FILE__)
srcdir = File.join(srcdir, test)
@@ -493,7 +501,7 @@ e"
end
def assert_dedented_heredoc(expect, result, mesg = "")
- %w[eos "eos" 'eos'].each do |eos|
+ %w[eos "eos" 'eos' `eos`].each do |eos|
assert_equal(eval("<<-#{eos}\n#{expect}eos\n"),
eval("<<~#{eos}\n#{result}eos\n"),
message(mesg) {"with #{eos}"})
@@ -587,6 +595,10 @@ e"
eval("<<~#{eos} ' y'\n x\neos\n"),
"#{bug11990} with #{eos}")
end
+ %w[eos "eos" 'eos' `eos`].each do |eos|
+ _, expect = eval("[<<~#{eos}, ' x']\n"" y\n""eos\n")
+ assert_equal(' x', expect, bug11990)
+ end
end
def test_lineno_after_heredoc