diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-30 06:01:14 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-30 06:01:14 +0000 |
commit | 1a02ec9170db08c0574978a9d09478422ff261fa (patch) | |
tree | c5f97a74a1ad88099f171497ac2321c5f3de136a /test | |
parent | 96ebf3bdd9e41b9d500534a134a35070e2947e23 (diff) | |
download | ruby-1a02ec9170db08c0574978a9d09478422ff261fa.tar.gz |
* string.c (tr_setup_table): initialize negating table when
negating string is given. [ruby-core:31851]
* string.c (tr_find): add a sentence for the time when
target characters include negating one.
* string.c (rb_str_count): move definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 6fc3167f45..f28c1c84e7 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -479,6 +479,8 @@ class TestString < Test::Unit::TestCase assert_equal(4, a.count(S("hello"), S("^l"))) assert_equal(4, a.count(S("ej-m"))) assert_equal(0, S("y").count(S("a\\-z"))) + assert_equal(5, "abc\u{3042 3044 3046}".count("^a")) + assert_equal(5, "abc\u{3042 3044 3046}".count("^\u3042")) assert_raise(ArgumentError) { "foo".count } end @@ -498,6 +500,9 @@ class TestString < Test::Unit::TestCase assert_equal(true, "a\u0101".delete("\u0101").ascii_only?) assert_equal(true, "a\u3041".delete("\u3041").ascii_only?) assert_equal(false, "a\u3041\u3042".tr("\u3041", "a").ascii_only?) + + assert_equal("a", "abc\u{3042 3044 3046}".delete("^a")) + assert_equal("\u3042", "abc\u{3042 3044 3046}".delete("^\u3042")) end def test_delete! |