summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-27 13:05:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-27 13:05:48 +0000
commit20a2b656c2cbaac6585cf8bf7b8b4f37ad7877ba (patch)
tree9b5852e193960154282ce416a27a4b529f7b298c /test/ruby
parentf582b224bd4f86efc4230fb9819d0065cdf66a46 (diff)
* string.c (rb_str_inspect): get rid of adding garbage to short
UTF-8 string. [ruby-dev:39550] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 25786fe9c5..5775f4b878 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -140,4 +140,17 @@ class TestString < Test::Unit::TestCase
ensure
$KCODE = original_kcode
end
+
+ def test_inspect
+ original_kcode = $KCODE
+
+ $KCODE = 'n'
+ assert_equal('"\343\201\202"', "\xe3\x81\x82".inspect)
+
+ $KCODE = 'u'
+ assert_equal("\"\xe3\x81\x82\"", "\xe3\x81\x82".inspect)
+ assert_no_match(/\0/, "\xe3\x81".inspect, '[ruby-dev:39550]')
+ ensure
+ $KCODE = original_kcode
+ end
end