diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-22 13:38:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-22 13:38:24 +0000 |
commit | 7b1bbd59e12f8c3f262c7157ea6b73f8e3e7dad6 (patch) | |
tree | 116c52ca2e559ab05bc7b3fee16906706207e682 | |
parent | 80d230c3945a0c79e5215b14c864b1acf503e163 (diff) | |
download | ruby-7b1bbd59e12f8c3f262c7157ea6b73f8e3e7dad6.tar.gz |
* test/ruby/test_string.rb (test_tr): test for [ruby-core:22328].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_string.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 4bee19bca3..c5375c735a 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 |