diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 13:22:53 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 13:22:53 +0000 |
commit | d3418343048213457d0686b807404babc949e994 (patch) | |
tree | 593cc1dba359009738d4cf552a7b22ebc3aa52d8 /test | |
parent | 0d0636d22ce7bd4729d749ca36cf2cde5175d815 (diff) |
merges r29868 and r29872 from trunk into ruby_1_9_2.
--
* string.c (rb_str_inspect): append for each chars instead of bulk
copy if encoding conversion is needed. [ruby-core:33283]
--
* string.c (rb_str_inspect): fix for ascii-compatible external
encoding and different encoding string. [ruby-core:33283]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index cea74c35e8..5c2bce15cc 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1886,10 +1886,20 @@ class TestString < Test::Unit::TestCase end def test_ascii_incomat_inspect + bug4081 = '[ruby-core:33283]' [Encoding::UTF_16LE, Encoding::UTF_16BE, Encoding::UTF_32LE, Encoding::UTF_32BE].each do |e| assert_equal('"abc"', "abc".encode(e).inspect) assert_equal('"\\u3042\\u3044\\u3046"', "\u3042\u3044\u3046".encode(e).inspect) + assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081) end + begin + ext = Encoding.default_external + Encoding.default_external = "us-ascii" + i = "abc\"\\".force_encoding("utf-8").inspect + ensure + Encoding.default_external = ext + end + assert_equal('"abc\\"\\\\"', i, bug4081) end end |