зеркало из https://github.com/github/ruby.git
hash.c: reject shoult infect
* hash.c (rb_hash_reject): result should be infected by the receiver. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0727a22c69
Коммит
cf85aaf83e
1
hash.c
1
hash.c
|
@ -1119,6 +1119,7 @@ rb_hash_reject(VALUE hash)
|
|||
|
||||
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
|
||||
ret = hash_alloc(rb_obj_class(hash));
|
||||
OBJ_INFECT(ret, hash);
|
||||
if (!RHASH_EMPTY_P(hash)) {
|
||||
rb_hash_foreach(hash, reject_i, ret);
|
||||
}
|
||||
|
|
|
@ -555,6 +555,8 @@ class TestHash < Test::Unit::TestCase
|
|||
|
||||
assert_equal(h3, h.reject {|k,v| v })
|
||||
assert_equal(base, h)
|
||||
|
||||
assert_predicate(h.taint.reject {true}, :tainted?)
|
||||
end
|
||||
|
||||
def test_reject!
|
||||
|
|
Загрузка…
Ссылка в новой задаче