ruby-changes:4933
From: ko1@a...
Date: Thu, 15 May 2008 23:03:39 +0900 (JST)
Subject: [ruby-changes:4933] mame - Ruby:r16426 (trunk): * string.c (tr_find): String#delete returned wrong result when multiple
mame 2008-05-15 23:03:21 +0900 (Thu, 15 May 2008)
New Revision: 16426
Modified files:
trunk/ChangeLog
trunk/string.c
trunk/test/ruby/test_m17n.rb
Log:
* string.c (tr_find): String#delete returned wrong result when multiple
utf-8 arguments are passed.
* test/ruby/test_m17n.rb (test_delete): add a test for above.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=16426&r2=16425&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16426&r2=16425&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_m17n.rb?r1=16426&r2=16425&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16425)
+++ ChangeLog (revision 16426)
@@ -1,3 +1,10 @@
+Thu May 15 23:01:06 2008 Yusuke Endoh <mame@t...>
+
+ * string.c (tr_find): String#delete returned wrong result when multiple
+ utf-8 arguments are passed.
+
+ * test/ruby/test_m17n.rb (test_delete): add a test for above.
+
Thu May 15 22:37:56 2008 NAKAMURA Usaku <usa@r...>
* parse.y (ripper_warningS): now used.
Index: string.c
===================================================================
--- string.c (revision 16425)
+++ string.c (revision 16426)
@@ -4530,12 +4530,12 @@
else {
VALUE v = INT2NUM(c);
- if (!del || NIL_P(rb_hash_lookup(del, v))) {
- return Qfalse;
+ if (del && !NIL_P(rb_hash_lookup(del, v))) {
+ if (!nodel || NIL_P(rb_hash_lookup(nodel, v))) {
+ return Qtrue;
+ }
}
- if (nodel && NIL_P(rb_hash_lookup(nodel, v)))
- return Qfalse;
- return Qtrue;
+ return Qfalse;
}
}
Index: test/ruby/test_m17n.rb
===================================================================
--- test/ruby/test_m17n.rb (revision 16425)
+++ test/ruby/test_m17n.rb (revision 16426)
@@ -894,6 +894,10 @@
assert_equal(1, e("\xa1\xa2").delete("z").length)
s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4")
assert_raise(ArgumentError){s.delete(a("\xa3\xb2"))}
+
+ a = "\u3042\u3044\u3046\u3042\u3044\u3046"
+ a.delete!("\u3042\u3044", "^\u3044")
+ assert_equal("\u3044\u3046\u3044\u3046", a)
end
def test_include?
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/