From 95f54fb01969fe2799dc6425bbd4102f334feada Mon Sep 17 00:00:00 2001 From: glass Date: Tue, 12 May 2015 13:24:53 +0000 Subject: * enum.c (enum_to_a): fix incompatibility introduced in r50457. [Bug #11130] * test/ruby/test_enum.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_enum.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 8b9a8c317e..6961187471 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -100,6 +100,36 @@ class TestEnumerable < Test::Unit::TestCase assert_equal([1, 2, 3, 1, 2], @obj.to_a) end + def test_to_a_size_symbol + sym = Object.new + class << sym + include Enumerable + def each + self + end + + def size + :size + end + end + assert_equal([], sym.to_a) + end + + def test_to_a_size_infinity + inf = Object.new + class << inf + include Enumerable + def each + self + end + + def size + Float::INFINITY + end + end + assert_equal([], inf.to_a) + end + def test_to_h obj = Object.new def obj.each(*args) -- cgit v1.2.3