* 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:
parent
0076f3b3f8
commit
45fa4a4b63
@ -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>
|
Sun Dec 9 12:03:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (parser_magic_comment): delimits with a semicolon.
|
* parse.y (parser_magic_comment): delimits with a semicolon.
|
||||||
|
@ -156,9 +156,4 @@ assert_equal 'true', %q{
|
|||||||
"\xa3\xb0".force_encoding("euc-jp"),
|
"\xa3\xb0".force_encoding("euc-jp"),
|
||||||
"\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
"\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||||
]
|
]
|
||||||
}
|
}, '[ruby-dev:32452]'
|
||||||
|
|
||||||
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")
|
|
||||||
}
|
|
||||||
|
4
string.c
4
string.c
@ -3674,8 +3674,8 @@ tr_find(int c, char table[256], VALUE del, VALUE nodel)
|
|||||||
else {
|
else {
|
||||||
VALUE v = INT2NUM(c);
|
VALUE v = INT2NUM(c);
|
||||||
|
|
||||||
if ((del && !NIL_P(rb_hash_aref(del, v))) &&
|
if ((!del || !NIL_P(rb_hash_lookup(del, v))) &&
|
||||||
(!nodel || NIL_P(rb_hash_aref(nodel, v)))) {
|
(!nodel || NIL_P(rb_hash_lookup(nodel, v)))) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
|
@ -489,4 +489,9 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
assert_equal(s.tr("A", "B"), s)
|
assert_equal(s.tr("A", "B"), s)
|
||||||
assert_equal(s.tr_s("A", "B"), s)
|
assert_equal(s.tr_s("A", "B"), s)
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user