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 | b5085355646f27462b8c407444644f38bd4ea879 (patch) | |
tree | ff39d172bd13f0cd839ede99dbc0302c3cd02931 /test | |
parent | 1641bfd3fec52dad9534adbe7afaa8691b7a62b8 (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/branches/ruby_1_9_1@20048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 |