* string.c (tr_setup_table): optimized. don't create hash objects

when given pattern is ASCII only.

* string.c (tr_find): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-09-01 07:52:16 +00:00
parent d53e0fe330
commit 09fb7189ec
3 changed files with 29 additions and 19 deletions

View file

@ -481,6 +481,7 @@ class TestString < Test::Unit::TestCase
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_equal(2, "abc\u{3042 3044 3046}".count("a-z", "^a"))
assert_raise(ArgumentError) { "foo".count }
end