summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bootstraptest/test_knownbug.rb7
-rw-r--r--string.c4
-rw-r--r--test/ruby/test_m17n.rb5
4 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 918f1c0fcf..14add27220 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Dec 9 12:12:23 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (tr_find): returns true if no characters to be removed is
+ specified.
+
Sun Dec 9 12:03:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_magic_comment): delimits with a semicolon.
diff --git a/bootstraptest/test_knownbug.rb b/bootstraptest/test_knownbug.rb
index a9cb8eb1a5..d2e36cfcd1 100644
--- a/bootstraptest/test_knownbug.rb
+++ b/bootstraptest/test_knownbug.rb
@@ -156,9 +156,4 @@ assert_equal 'true', %q{
"\xa3\xb0".force_encoding("euc-jp"),
"\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
]
-}
-
-assert_equal 'true', %q{
- s = "\xa3\xb0\xa3\xb1\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
- s.squeeze == "\xa3\xb0\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
-}
+}, '[ruby-dev:32452]'
diff --git a/string.c b/string.c
index 8ed34edfd8..b716c16b15 100644
--- a/string.c
+++ b/string.c
@@ -3674,8 +3674,8 @@ tr_find(int c, char table[256], VALUE del, VALUE nodel)
else {
VALUE v = INT2NUM(c);
- if ((del && !NIL_P(rb_hash_aref(del, v))) &&
- (!nodel || NIL_P(rb_hash_aref(nodel, v)))) {
+ if ((!del || !NIL_P(rb_hash_lookup(del, v))) &&
+ (!nodel || NIL_P(rb_hash_lookup(nodel, v)))) {
return Qtrue;
}
return Qfalse;
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 542c3d2b00..28f636fc65 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -489,4 +489,9 @@ class TestM17N < Test::Unit::TestCase
assert_equal(s.tr("A", "B"), s)
assert_equal(s.tr_s("A", "B"), s)
end
+
+ def test_squeeze
+ s = "\xa3\xb0\xa3\xb1\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
+ assert_equal("\xa3\xb0\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp"), s.squeeze)
+ end
end