mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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@36549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
76ff1d90c8
commit
044aa29b7d
1 changed files with 2 additions and 1 deletions
|
@ -286,7 +286,8 @@ class TestLazyEnumerator < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_cycle_chain
|
||||
a = Step.new(1..3)
|
||||
a = 1..3
|
||||
assert_equal([1,2,3,1,2,3,1,2,3,1], a.lazy.cycle.take(10).force)
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue