aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_literal.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 13:48:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 13:48:51 +0000
commitb4efab9ed9e2e945b230c8c5cefd0172a02b8eb5 (patch)
treef170f5a1046873ffd627e7b361f9efb1d783172f /test/ruby/test_literal.rb
parent9fb0863f4f760dfb1b5deb47b37a32cc96b26478 (diff)
downloadruby-b4efab9ed9e2e945b230c8c5cefd0172a02b8eb5.tar.gz
parse.y: keep literal encoding
* parse.y (literal_concat_gen, evstr2dstr_gen): keep literal encoding beginning with an interpolation same as the source file encoding. [ruby-core:70703] [Bug #11519] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_literal.rb')
-rw-r--r--test/ruby/test_literal.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index ed5f83655c..302f487bb6 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -102,6 +102,15 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_equal('FooBar', b, 'r3842')
end
+ def test_dstring_encoding
+ bug11519 = '[ruby-core:70703] [Bug #11519]'
+ ['"foo#{}"', '"#{}foo"', '"#{}"'].each do |code|
+ a = eval("#-*- coding: utf-8 -*-\n#{code}")
+ assert_equal(Encoding::UTF_8, a.encoding,
+ proc{"#{bug11519}: #{code}.encoding"})
+ end
+ end
+
def test_dsymbol
assert_equal :a3c, :"a#{1+2}c"
end