summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-11-24 14:05:22 -0800
committerJeremy Evans <code@jeremyevans.net>2021-03-06 13:56:16 -0800
commitbf40fe9fed19a5e22081b133661c0629988f1618 (patch)
tree0a24947c37be27b59e3fe84bd8e3a72711b9e907 /test/ruby/test_enumerator.rb
parent13dc00534786057c6b934b7269dac49352959099 (diff)
Fix calling enumerator methods such as with_index on Enumerator::Chain
This previously raised a TypeError. Wrap the Enumerator::Chain in an Enumerator to work around the problem. Fixes [Bug #17216]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3811
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 718bcb74b6..9b615ff9db 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -816,6 +816,10 @@ class TestEnumerator < Test::Unit::TestCase
)
end
+ def test_chain_with_index
+ assert_equal([[3, 0], [4, 1]], [3].chain([4]).with_index.to_a)
+ end
+
def test_produce
assert_raise(ArgumentError) { Enumerator.produce }