summaryrefslogtreecommitdiff
path: root/test/ruby/test_lazy_enumerator.rb
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@idaemons.org>2019-06-05 20:39:21 +0900
committerAkinori MUSHA <knu@idaemons.org>2019-09-04 16:16:46 +0900
commit1d4bd229b898671328c2a942b04f08065c640c28 (patch)
treeecd881beea9ddc035e2061a27886fded9bd82f8f /test/ruby/test_lazy_enumerator.rb
parent2a6457b5b7d67378528235cee7b9cb93fed00204 (diff)
Implement Enumerator::Lazy#eager [Feature #15901]
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r--test/ruby/test_lazy_enumerator.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index 72fe1a4..caa9a9c 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)