summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-13 15:59:51 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-13 15:59:51 +0000
commit6de1532775ec9802acc71c2c8b21794309b479b9 (patch)
treed2bae3abf015e991aa3be3d729f4eb3109ca7fd2 /test
parentcf6247135b197aa3951cd70e9e7219149c2f520a (diff)
merge revision(s) 25515:
* string.c (rb_str_inspect): get rid of adding garbage to shor UTF-8 string. [ruby-dev:39550] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index f8938cad84..cb1bd575e5 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -16,4 +16,17 @@ class TestString < Test::Unit::TestCase
check_sum("xyz", bits)
}
end
+
+ def test_inspect
+ original_kcode = $KCODE
+
+ $KCODE = 'n'
+ assert_equal('"\343\201\202"', "\xe3\x81\x82".inspect)
+
+ $KCODE = 'u'
+ assert_equal('"\\343\\201\\202"', "\xe3\x81\x82".inspect)
+ assert_no_match(/\0/, "\xe3\x81".inspect, '[ruby-dev:39550]')
+ ensure
+ $KCODE = original_kcode
+ end
end