diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_enumerator.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb index d0dc3a8bc4..bb04480b3d 100644 --- a/test/ruby/test_enumerator.rb +++ b/test/ruby/test_enumerator.rb @@ -127,6 +127,16 @@ class TestEnumerator < Test::Unit::TestCase assert_equal([[1,5],[2,6],[3,7]], @obj.to_enum(:foo, 1, 2, 3).with_index(5).to_a) end + def test_with_index_under_gc_compact_stress + EnvUtil.under_gc_compact_stress do + assert_equal([[1, 0], [2, 1], [3, 2]], @obj.to_enum(:foo, 1, 2, 3).with_index.to_a) + assert_equal([[1, 5], [2, 6], [3, 7]], @obj.to_enum(:foo, 1, 2, 3).with_index(5).to_a) + + s = 1 << (8 * 1.size - 2) + assert_equal([[1, s], [2, s + 1], [3, s + 2]], @obj.to_enum(:foo, 1, 2, 3).with_index(s).to_a) + end + end + def test_with_index_large_offset bug8010 = '[ruby-dev:47131] [Bug #8010]' s = 1 << (8*1.size-2) |