diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-17 14:29:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-17 14:29:00 +0000 |
commit | b421bd0e12fd8cb98e9ae4320c8db22454934324 (patch) | |
tree | c06eb0fcd029d947934c9544761a67f670c7de14 /test/ruby/test_object.rb | |
parent | f7c2791c6092728077777cd6ffbc3476e5a11a42 (diff) | |
download | ruby-b421bd0e12fd8cb98e9ae4320c8db22454934324.tar.gz |
object.c: preserve encodings
* object.c (rb_any_to_s, rb_obj_inspect): preserve encodings of class
name and instance variable names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_object.rb')
-rw-r--r-- | test/ruby/test_object.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 61482f7c1a..b8edd24670 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -688,6 +688,13 @@ class TestObject < Test::Unit::TestCase s = x.to_s assert_equal(true, s.untrusted?) assert_equal(true, s.tainted?) + + x = eval(<<-EOS) + class ToS\u{3042} + new.to_s + end + EOS + assert_match(/\bToS\u{3042}:/, x) end def test_inspect @@ -713,6 +720,23 @@ class TestObject < Test::Unit::TestCase "to_s" end assert_match(/\A#<Object:0x\h+>\z/, x.inspect, feature6130) + + x = eval(<<-EOS) + class Inspect\u{3042} + new.inspect + end + EOS + assert_match(/\bInspect\u{3042}:/, x) + + x = eval(<<-EOS) + class Inspect\u{3042} + def initialize + @\u{3044} = 42 + end + new.inspect + end + EOS + assert_match(/\bInspect\u{3042}:.* @\u{3044}=42\b/, x) end def test_exec_recursive |