diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 17:24:44 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 17:24:44 +0000 |
commit | e2cb0b9766537e6db2bd515339c598d3aca438d2 (patch) | |
tree | dea1dc005b8cb262527fbf46017267594011512e /test/ruby/test_array.rb | |
parent | 143f059bcd84284b54445d237ad202f1cb3e639a (diff) | |
download | ruby-e2cb0b9766537e6db2bd515339c598d3aca438d2.tar.gz |
* 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.rb | 8 |
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 |