summaryrefslogtreecommitdiff
path: root/test/ruby/test_lazy_enumerator.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-05-27 13:29:24 -0700
committerJeremy Evans <code@jeremyevans.net>2021-05-27 14:17:32 -0700
commitfd8991f797c145615820b4c76e6b7ac5a71339ea (patch)
tree7906cbb1c358e6aef9d260eb962e06389992e16c /test/ruby/test_lazy_enumerator.rb
parent029169bc5b45d8ec783c19eaf713395b7983d16a (diff)
Fix lazy enumerator with index size
Fixes [Bug #17889]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4534
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r--test/ruby/test_lazy_enumerator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb
index 3f5a05555b..2116d0ee31 100644
--- a/test/ruby/test_lazy_enumerator.rb
+++ b/test/ruby/test_lazy_enumerator.rb
@@ -682,4 +682,8 @@ EOS
ary = (0..Float::INFINITY).lazy.with_index.take(2).to_a
assert_equal([[0, 0], [1, 1]], ary)
end
+
+ def test_with_index_size
+ assert_equal(3, Enumerator::Lazy.new([1, 2, 3], 3){|y, v| y << v}.with_index.size)
+ end
end