summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-27 08:07:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-27 08:07:21 +0000
commit76ff1d90c809fe61616fac7ff26b3c98bdd49f3a (patch)
tree0e0aafbe010ae2b2e6219a912fb7ad8998916557 /test/ruby
parent1d7ebc5c5ed3c9e11d297dc414bbaf4aafb4633d (diff)
test_lazy_enumerator.rb: test for cycle chain
* test/ruby/test_lazy_enumerator.rb (test_cycle_chain): more test for infinite sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_lazy_enumerator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index a1605a8af0..8ed6da2800 100644
--- a/test/ruby/test_lazy_enumerator.rb
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -285,6 +285,12 @@ class TestLazyEnumerator < Test::Unit::TestCase
assert_equal(3, a.current)
end
+ def test_cycle_chain
+ a = Step.new(1..3)
+ assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.cycle.select {|x| x == 2}.take(10).force)
+ assert_equal([2,2,2,2,2,2,2,2,2,2], a.lazy.select {|x| x == 2}.cycle.take(10).force)
+ end
+
def test_force
assert_equal([1, 2, 3], (1..Float::INFINITY).lazy.take(3).force)
end