aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:13:33 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:13:33 +0000
commit19ed71c8d035e14d6ca39af4e52fb6630cb56c23 (patch)
treeb2f00e892cf00aba526f47cd3433c370533a3163 /test
parentcef054d5b2d29422b2160783aea6d0581c701483 (diff)
downloadruby-19ed71c8d035e14d6ca39af4e52fb6630cb56c23.tar.gz
* hash.c: Support for enumerators created by Hash:
delete_if, reject!, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_enumerator.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 66d5e28a14..af41341227 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -443,6 +443,13 @@ class TestEnumerator < Test::Unit::TestCase
assert_equal 42, @sized.each_with_object(nil).size
end
+ def test_size_for_enum_created_from_hash
+ h = {a: 1, b: 2, c: 3}
+ %i[delete_if reject! select select! keep_if each each_key each_pair].each do |method|
+ assert_equal 3, h.send(method).size
+ end
+ end
+
def check_consistency_for_combinatorics(method)
[ [], [:a, :b, :c, :d, :e] ].product([-2, 0, 2, 5, 6]) do |array, arg|
assert_equal array.send(method, arg).to_a.size, array.send(method, arg).size,