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

* hash.c (rb_hash_delete_key): delete the entry without calling block.

* hash.c (rb_hash_shift): should consider iter_lev too.

* hash.c (delete_if_i): use rb_hash_delete_key() so that the block
  isn't called twice.  [ruby-core:11556]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-15 04:50:12 +00:00
parent 686535d403
commit 4edc1d8c9c
3 changed files with 57 additions and 16 deletions

View file

@ -266,6 +266,17 @@ class TestHash < Test::Unit::TestCase
h = base.dup
assert_equal(h3, h.delete_if {|k,v| v })
assert_equal(h3, h)
h = base.dup
n = 0
h.delete_if {|*a|
n += 1
assert_equal(2, a.size)
assert_equal(base[a[0]], a[1])
h.shift
true
}
assert_equal(base.size, n)
end
def test_dup