mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 09:04:05 +02:00
* 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
This commit is contained in:
parent
143f059bcd
commit
e2cb0b9766
3 changed files with 20 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue