aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index e1b23792bd..e08edd512c 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -134,6 +134,16 @@ class TestEnumerator < Test::Unit::TestCase
assert_raise(TypeError, bug8010){ @obj.to_enum(:foo, 1, 2, 3).with_index('1').to_a }
end
+ def test_with_index_dangling_memo
+ bug9178 = '[ruby-core:58692] [Bug #9178]'
+ assert_separately([], <<-"end;")
+ bug = "#{bug9178}"
+ e = [1].to_enum(:chunk).with_index {|c,i| i == 5}
+ assert_kind_of(Enumerator, e)
+ assert_equal([false, [1]], e.to_a[0], bug)
+ end;
+ end
+
def test_with_object
obj = [0, 1]
ret = (1..10).each.with_object(obj) {|i, memo|