diff options
author | Akinori MUSHA <knu@idaemons.org> | 2019-06-05 20:39:21 +0900 |
---|---|---|
committer | Akinori MUSHA <knu@idaemons.org> | 2019-09-04 16:16:46 +0900 |
commit | 1d4bd229b898671328c2a942b04f08065c640c28 (patch) | |
tree | ecd881beea9ddc035e2061a27886fded9bd82f8f /test | |
parent | 2a6457b5b7d67378528235cee7b9cb93fed00204 (diff) | |
download | ruby-1d4bd229b898671328c2a942b04f08065c640c28.tar.gz |
Implement Enumerator::Lazy#eager [Feature #15901]
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 72fe1a4a24..caa9a9c713 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -452,6 +452,14 @@ class TestLazyEnumerator < Test::Unit::TestCase EOS end + def test_lazy_eager + lazy = [1, 2, 3].lazy.map { |x| x * 2 } + enum = lazy.eager + assert_equal Enumerator, enum.class + assert_equal 3, enum.size + assert_equal [1, 2, 3], enum.map { |x| x / 2 } + end + def test_lazy_to_enum lazy = [1, 2, 3].lazy def lazy.foo(*args) |