summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-13 08:34:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-13 08:34:17 +0000
commit537b4a64227aebf357a5c3f570e01be5f2f824fd (patch)
tree7b090ed0a815cfe046566f64ed76e44a3f59a520 /test/ruby/test_array.rb
parent95bac4f75e0f8ccaf0b54c848b6a187cda63b115 (diff)
array.c: combination on a shared copy
* 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/trunk@46418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r--test/ruby/test_array.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 676b20b1c4..a3d7163605 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -2291,6 +2291,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