diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-06 17:12:05 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-06 17:12:05 +0000 |
commit | b8b01ab995b963db825b9b493aa98500f0be83e0 (patch) | |
tree | 2a849367b23c9f58743dabdd7d8a88287f9ee2bb /test/ruby/test_enumerator.rb | |
parent | ba59365db9283b23b1a2dd9b91dac7303c798326 (diff) |
* array.c (rb_ary_cycle): Support for Array#cycle.size
[Feature #6636]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r-- | test/ruby/test_enumerator.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb index 93d46a6c23..49d7827d35 100644 --- a/test/ruby/test_enumerator.rb +++ b/test/ruby/test_enumerator.rb @@ -456,5 +456,13 @@ class TestEnumerator < Test::Unit::TestCase (1..59).to_a.repeated_combination(42).size # 1.upto(100).inject(:*) / 1.upto(42).inject(:*) / 1.upto(58).inject(:*) end + + def test_size_for_cycle + assert_equal Float::INFINITY, [:foo].cycle.size + assert_equal 10, [:foo, :bar].cycle(5).size + assert_equal 0, [:foo, :bar].cycle(-10).size + assert_equal 0, [].cycle.size + assert_equal 0, [].cycle(5).size + end end |