* string.c (tr_setup_table): fix bug in r29146.

Initialize table even if cflag is 0; tr_find see whether
  del is empty or not.

* string.c (tr_find): nodel can't be NULL; if NULL, it means
  it is not specified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-08-30 19:45:30 +00:00
parent 16ceba0396
commit d074ef4d60
6 changed files with 22 additions and 9 deletions

View file

@ -502,6 +502,7 @@ class TestString < Test::Unit::TestCase
assert_equal(false, "a\u3041\u3042".tr("\u3041", "a").ascii_only?)
assert_equal("a", "abc\u{3042 3044 3046}".delete("^a"))
assert_equal("bc\u{3042 3044 3046}", "abc\u{3042 3044 3046}".delete("a"))
assert_equal("\u3042", "abc\u{3042 3044 3046}".delete("^\u3042"))
end