diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-09 05:34:41 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-09 05:34:41 +0000 |
commit | a21d0f72c280a3effe15554279ae006918cd97ce (patch) | |
tree | 4656f544b87a81044c5b0192be5d82bb9289bf2f /test | |
parent | 5452b18f9905ea404cd0bbfff5536f031bb83450 (diff) | |
download | ruby-a21d0f72c280a3effe15554279ae006918cd97ce.tar.gz |
* enumerator.c (lazy_flat_map): add Enumerable::Lazy#flat_map.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 eeede6600c..9b74429a7f 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -80,6 +80,14 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(1, a.current) end + def test_flat_map + a = Step.new(1..3) + assert_equal(2, a.flat_map {|x| [x * 2]}.first) + assert_equal(3, a.current) + assert_equal(2, a.lazy.flat_map {|x| [x * 2]}.first) + assert_equal(1, a.current) + end + def test_reject a = Step.new(1..6) assert_equal(4, a.reject {|x| x < 4}.first) |