diff options
author | Shugo Maeda <shugo@ruby-lang.org> | 2019-06-21 17:27:20 +0900 |
---|---|---|
committer | Shugo Maeda <shugo@ruby-lang.org> | 2019-06-21 17:42:27 +0900 |
commit | 702cf3ec9051914c8ef5a353580e0e74f7ec7005 (patch) | |
tree | b75f662ba24b5ec7a86c1f8688a5713663ccd4b0 /test/ruby/test_lazy_enumerator.rb | |
parent | 35392ff0a00934ec02558305b7be8dffe6420d30 (diff) |
Enumerator::Lazy should support filter_map
Fixes [Bug #15949]
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 e76a53e650..679e0291b1 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -116,6 +116,14 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(expected, a.lazy.map {|*args| args}.map {|*args| args}.to_a, bug) end + def test_filter_map + a = Step.new(1..3) + assert_equal(2, a.filter_map {|x| x.odd? && x * 2}.first) + assert_equal(3, a.current) + assert_equal(2, a.lazy.filter_map {|x| x.odd? && x * 2}.first) + 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) |