From bea02d1b35a389cd70f349183776cc96be29abc2 Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 31 Aug 2014 06:56:43 +0000 Subject: merge revision(s) 46417,46418: [Backport #9939] * array.c (yield_indexed_values): extract from permute0(), rpermute0(), and rcombinate0(). * array.c (rb_ary_combination): iterate on a shared copy, and use array of indexes instead of array of chosen objects. [ruby-core:63149] [Bug #9939] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby/test_array.rb') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 2f03b93a4b..5812958f0d 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -2201,6 +2201,15 @@ class TestArray < Test::Unit::TestCase assert_equal(:called, (0..100).to_a.combination(50) { break :called }, "[ruby-core:29240] ... must be yielded even if 100C50 > signed integer") end + def test_combination_clear + bug9939 = '[ruby-core:63149] [Bug #9939]' + assert_separately([], <<-'end;') + 100_000.times {Array.new(1000)} + a = [*0..100] + a.combination(3) {|*,x| a.clear} + end; + end + def test_product2 a = (0..100).to_a assert_raise(RangeError) do -- cgit v1.2.3