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 | 653e133e2a116f7722075e126cdecb104d184e11 (patch) | |
tree | dea1dc005b8cb262527fbf46017267594011512e /test/ruby | |
parent | 37abf737e2280410be022147f5782f8fcc5a5052 (diff) | |
download | ruby-653e133e2a116f7722075e126cdecb104d184e11.tar.gz ruby-653e133e2a116f7722075e126cdecb104d184e11.tar.xz ruby-653e133e2a116f7722075e126cdecb104d184e11.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@20048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 862385236..820166a0a 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 |