aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-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