aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-27 02:50:08 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-27 02:50:08 +0000
commitca7f52a32a9e7967fafc7efd65423303c36753b5 (patch)
tree8bf0ca149127059d6999467d50b8078e6ac43cbc /test/ruby/test_enumerator.rb
parentc4fe5260114482143943bead5b68a628a047c863 (diff)
downloadruby-ca7f52a32a9e7967fafc7efd65423303c36753b5.tar.gz
* enumerator.c: Allow Enumerator size argument to be any callable.
Patch by Avdi Grimm. [bug #8641] [ruby-core:56032] [fix GH-362] * test/ruby/test_enumerator.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index e3270f3d6a..e1b23792bd 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -452,6 +452,9 @@ class TestEnumerator < Test::Unit::TestCase
def test_size
assert_equal nil, Enumerator.new{}.size
assert_equal 42, Enumerator.new(->{42}){}.size
+ obj = Object.new
+ def obj.call; 42; end
+ assert_equal 42, Enumerator.new(obj){}.size
assert_equal 42, Enumerator.new(42){}.size
assert_equal 1 << 70, Enumerator.new(1 << 70){}.size
assert_equal Float::INFINITY, Enumerator.new(Float::INFINITY){}.size