summaryrefslogtreecommitdiffstats
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 13:38:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 13:38:24 +0000
commitc1833d14d1e801e1a2f4b293b90d65f6b6c5a415 (patch)
tree116c52ca2e559ab05bc7b3fee16906706207e682 /test/ruby/test_string.rb
parentb8dbbe13fa4d0bbd4b51baa80e4572b35f11cbb2 (diff)
downloadruby-c1833d14d1e801e1a2f4b293b90d65f6b6c5a415.tar.gz
ruby-c1833d14d1e801e1a2f4b293b90d65f6b6c5a415.tar.xz
ruby-c1833d14d1e801e1a2f4b293b90d65f6b6c5a415.zip
* test/ruby/test_string.rb (test_tr): test for [ruby-core:22328].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 4bee19bca..c5375c735 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1397,7 +1397,12 @@ class TestString < Test::Unit::TestCase
assert_equal(S("hal"), S("ibm").tr(S("b-z"), S("a-z")))
a = "abc".force_encoding(Encoding::US_ASCII)
- assert_equal(Encoding::US_ASCII, a.tr(S("z"), S("\u0101")).encoding)
+ assert_equal(Encoding::US_ASCII, a.tr(S("z"), S("\u0101")).encoding, '[ruby-core:22326]')
+
+ assert_equal("a".hash, "a".tr("a", "\u0101").tr("\u0101", "a").hash, '[ruby-core:22328]')
+ assert_equal(true, "\u0101".tr("\u0101", "a").ascii_only?)
+ assert_equal(true, "\u3041".tr("\u3041", "a").ascii_only?)
+ assert_equal(false, "\u3041\u3042".tr("\u3041", "a").ascii_only?)
end
def test_tr!
@@ -1420,8 +1425,8 @@ class TestString < Test::Unit::TestCase
assert_equal(S("ibm"), a)
a = "abc".force_encoding(Encoding::US_ASCII)
- assert_nil(a.tr!(S("z"), S("\u0101")))
- assert_equal(Encoding::US_ASCII, a.encoding)
+ assert_nil(a.tr!(S("z"), S("\u0101")), '[ruby-core:22326]')
+ assert_equal(Encoding::US_ASCII, a.encoding, '[ruby-core:22326]')
end
def test_tr_s