diff options
author | glass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-12 13:24:53 +0000 |
---|---|---|
committer | glass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-12 13:24:53 +0000 |
commit | 7ea98b5db67d6378eb430ea98438424688a7db09 (patch) | |
tree | 708435a679e1c6ba9bffa93b213f7035457d2f08 /test/ruby | |
parent | b485a939bacd4c7db0e4094dbe3d3c1bbac44b87 (diff) | |
download | ruby-7ea98b5db67d6378eb430ea98438424688a7db09.tar.gz |
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_enum.rb | 30 |
1 files changed, 30 insertions, 0 deletions
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) |