summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 17:24:44 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 17:24:44 +0000
commite2cb0b9766537e6db2bd515339c598d3aca438d2 (patch)
treedea1dc005b8cb262527fbf46017267594011512e /test/ruby/test_array.rb
parent143f059bcd84284b54445d237ad202f1cb3e639a (diff)
* array.c (rb_ary_sort_bang): remove SEGV when replacing array with
embedded one during sort. * test/ruby/test_array.rb (test_sort!): add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r--test/ruby/test_array.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 862385236e..820166a0a3 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1157,6 +1157,14 @@ class TestArray < Test::Unit::TestCase
assert_equal(@cls[1], @cls[1].sort!)
assert_equal(@cls[], @cls[].sort!)
+
+ a = @cls[4, 3, 2, 1]
+ a.sort! {|m, n| a.replace([9, 8, 7, 6]); m <=> n }
+ assert_equal([1, 2, 3, 4], a)
+
+ a = @cls[4, 3, 2, 1]
+ a.sort! {|m, n| a.replace([9, 8, 7]); m <=> n }
+ assert_equal([1, 2, 3, 4], a)
end
def test_sort_with_callcc