diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-05-22 14:32:22 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-05-22 14:34:23 +0900 |
commit | c4162a4cb82278b0674452304c96b5775d5b7d6d (patch) | |
tree | ec74f9073f01c757f5dd31e76eaec5b755162603 /test/ruby/test_array.rb | |
parent | 8b00bfb7c2c33827490c78a16c44b102cb0d724b (diff) |
Refined portability of test for [Bug #17739]
The order of arguments to callback of qsort is not defined.
That means `a` may not be 3 at all.
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 0a9ba90564..8f05f9cebd 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1667,10 +1667,11 @@ class TestArray < Test::Unit::TestCase array = [1, 2, 3, 4, 5] frozen_array = nil assert_raise(FrozenError) do + count = 0 array.sort! do |a, b| - array.freeze if a == 3 + array.freeze if (count += 1) == 6 frozen_array ||= array.map.to_a if array.frozen? - 1 + b <=> a end end assert_equal(frozen_array, array) |