summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:10:35 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:10:35 +0000
commit57d596cdb4a0de82288e3f526126ddf23fff0c41 (patch)
treefa14ff350832f2904ae798bc0163c8cb5b74c796 /test/ruby/test_enumerator.rb
parentacfd34a6a9e6462ed05f74e07f204b98d93126ff (diff)
* enumerator.c: Support #size for enumerators created from enumerators
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 8efc812fc5..3143be21a0 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -414,5 +414,11 @@ class TestEnumerator < Test::Unit::TestCase
assert_equal nil, @obj.to_enum(:foo, 0, 1).size
assert_equal 2, @obj.to_enum(:foo, 0, 1){ 2 }.size
end
+
+ def test_size_for_enum_created_by_enumerators
+ enum = to_enum{ 42 }
+ assert_equal 42, enum.with_index.size
+ assert_equal 42, enum.with_object(:foo).size
+ end
end