1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (tr_find): returns true if no characters to be removed is

specified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-12-09 03:12:25 +00:00
parent 0076f3b3f8
commit 45fa4a4b63
4 changed files with 13 additions and 8 deletions

View file

@ -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.

View file

@ -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]'

View file

@ -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;

View file

@ -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