aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_lazy_enumerator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r--test/ruby/test_lazy_enumerator.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index 9b74429a7f..6d96438454 100644
--- a/test/ruby/test_lazy_enumerator.rb
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -109,4 +109,26 @@ class TestLazyEnumerator < Test::Unit::TestCase
assert_equal('c', a.lazy.grep(/c/).first)
assert_equal('c', a.current)
end
+
+ def test_zip
+ a = Step.new(1..3)
+ assert_equal([1, "a"], a.zip("a".."c").first)
+ assert_equal(3, a.current)
+ assert_equal([1, "a"], a.lazy.zip("a".."c").first)
+ assert_equal(1, a.current)
+ end
+
+ def test_zip_without_arg
+ a = Step.new(1..3)
+ assert_equal([1], a.zip.first)
+ assert_equal(3, a.current)
+ assert_equal([1], a.lazy.zip.first)
+ assert_equal(1, a.current)
+ end
+
+ def test_zip_with_block
+ a = Step.new(1..3)
+ assert_equal(["a", 1], a.lazy.zip("a".."c") {|x, y| [y, x]}.first)
+ assert_equal(1, a.current)
+ end
end