diff options
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r-- | test/ruby/test_lazy_enumerator.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 9e50cd3a69..3adaaa32f3 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -143,4 +143,12 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(["a", 1], a.lazy.zip("a".."c") {|x, y| [y, x]}.first) assert_equal(1, a.current) end + + def test_take + a = Step.new(1..3) + assert_equal(1, a.take(2).first) + assert_equal(2, a.current) + assert_equal(1, a.lazy.take(2).first) + assert_equal(1, a.current) + end end |