summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-12 15:45:59 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-12 15:45:59 +0000
commitb28f3e5c4ffb46db1247df8b7aa94a25cf0c3bba (patch)
tree9176d4ea95572d3740eb06c8e47f771c5701eb45 /test
parent5b78e48c318b342c46943a4723f3d556ead7795b (diff)
* lib/prime.rb: Return sized enumerators.
Patch by Kenichi Kamiya [GH-931] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/test_prime.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_prime.rb b/test/test_prime.rb
index d4f0564..48b017e 100644
--- a/test/test_prime.rb
+++ b/test/test_prime.rb
@@ -106,6 +106,13 @@ class TestPrime < Test::Unit::TestCase
end
end
+ def test_enumerator_size
+ enum = Prime.each
+ assert_equal Float::INFINITY, enum.size
+ assert_equal Float::INFINITY, enum.with_object(nil).size
+ assert_equal Float::INFINITY, enum.with_index(42).size
+ end
+
def test_default_instance_does_not_have_compatibility_methods
assert !Prime.instance.respond_to?(:succ)
assert !Prime.instance.respond_to?(:next)