aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 23:08:15 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 23:08:15 +0000
commit22434473c72b27bbf699cfcb62f2df38c71cfe10 (patch)
treef41cb7af6b47509b991936feb3cfc518fbb6b60a /test
parentf24d9fcd7510dfa0ac9ab22111de48592313db6e (diff)
downloadruby-22434473c72b27bbf699cfcb62f2df38c71cfe10.tar.gz
* enumerator.c (lazy_zip): add Enumerable::Lazy#flat_map.
* enumerator.c (lazy_lazy): just returns self. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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