summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:14:02 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:14:02 +0000
commitce0bf9f43d9d1828bfd1d8001dcba729d9553f38 (patch)
tree6c76586cce264a0af38a782d653480e4ccb01089 /test/ruby/test_enumerator.rb
parent17c0aff0d6d8a2629b535a52a93e348904e27b97 (diff)
* struct.c: Support for Struct's enumerators #size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-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 884f8c6b27..c45e3eb0a7 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -456,6 +456,13 @@ class TestEnumerator < Test::Unit::TestCase
end
end
+ def test_size_for_enum_created_from_struct
+ s = Struct.new(:foo, :bar, :baz).new(1, 2)
+ %i[each each_pair select].each do |method|
+ assert_equal 3, s.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,