aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_m17n.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 02:48:34 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-13 02:48:34 +0000
commitc69ef4127734c583770b13411e49cbec7af817cd (patch)
treee3a43165067b727ac766bf097860e3a4e1976468 /test/ruby/test_m17n.rb
parent9d3642f25adf8e143c0717d81017ca9f249aa995 (diff)
downloadruby-c69ef4127734c583770b13411e49cbec7af817cd.tar.gz
* object.c (rb_inspect): check the default internal encoding as
String#inspect do. [ruby-dev:49415] [Bug #11787] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_m17n.rb')
-rw-r--r--test/ruby/test_m17n.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 2e9e65b52f..4efe18187b 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1648,4 +1648,17 @@ class TestM17N < Test::Unit::TestCase
assert_match(escape_plain, 0x5b.chr(::Encoding::UTF_8), bug10670)
assert_match(escape_plain, 0x5b.chr, bug10670)
end
+
+ def test_inspect_with_default_internal
+ bug11787 = '[ruby-dev:49415] [Bug #11787]'
+
+ orig_int = Encoding.default_internal
+ Encoding.default_internal = ::Encoding::EUC_JP
+ s = begin
+ [e("\xB4\xC1\xBB\xFA")].inspect
+ ensure
+ Encoding.default_internal = orig_int
+ end
+ assert_equal(e("[\"\xB4\xC1\xBB\xFA\"]"), s, bug11787)
+ end
end