зеркало из https://github.com/github/ruby.git
* 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:
Родитель
0076f3b3f8
Коммит
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>
|
||||
|
||||
* parse.y (parser_magic_comment): delimits with a semicolon.
|
||||
|
|
|
@ -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]'
|
||||
|
|
4
string.c
4
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;
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче