diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 04:50:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 04:50:12 +0000 |
commit | 4edc1d8c9c234303096e6e5a35e87944b50d247d (patch) | |
tree | b745b8951d62998f811ae9cb83a4472e46bcd32f /test | |
parent | 686535d403395587995082e5436f3131e80a04d7 (diff) | |
download | ruby-4edc1d8c9c234303096e6e5a35e87944b50d247d.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index b23552aeae..440736765c 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -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 |