summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 23:16:37 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 23:16:37 +0000
commit6b4525912b67b085b1c6d958fdca8aef87a6c28d (patch)
tree26ca92669064590201626ac955d3f43249b9597f /test/ruby
parent22434473c72b27bbf699cfcb62f2df38c71cfe10 (diff)
* enumerator.c (lazy_zip_func): use each for non-Array objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_lazy_enumerator.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index 6d96438454..9dbabafaa9 100644
--- a/test/ruby/test_lazy_enumerator.rb
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -88,6 +88,16 @@ class TestLazyEnumerator < Test::Unit::TestCase
assert_equal(1, a.current)
end
+ def test_flat_map_nested
+ a = Step.new(1..3)
+ assert_equal([1, "a"],
+ a.flat_map {|x| ("a".."c").map {|y| [x, y]}}.first)
+ assert_equal(3, a.current)
+ assert_equal([1, "a"],
+ a.lazy.flat_map {|x| ("a".."c").lazy.map {|y| [x, y]}}.first)
+ assert_equal(1, a.current)
+ end
+
def test_reject
a = Step.new(1..6)
assert_equal(4, a.reject {|x| x < 4}.first)