diff options
author | Luke Gruber <luke.gru@gmail.com> | 2019-06-22 11:25:52 -0400 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-23 00:49:24 +0900 |
commit | c033dc3073839e3578f1ba25d53b837974b56474 (patch) | |
tree | 87747b83fcedcc123b237bff91e4c62b21027696 /test/ruby/test_array.rb | |
parent | fd9ac1e76bc8b347ad55fdf5991839c1df4e891a (diff) |
Fix issue with Array#rindex when rb_equal modifies receiver array
Fixes [Bug #15951]
Closes: https://github.com/ruby/ruby/pull/2250
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index df9f08a26d..88d61b79e0 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1438,6 +1438,16 @@ class TestArray < Test::Unit::TestCase assert_nil(a.rindex([1,2])) assert_equal(3, a.rindex(99) {|x| x == [1,2,3] }) + + bug15951 = "[Bug #15951]" + o2 = Object.new + def o2.==(other) + other.replace([]) if Array === other + false + end + a = Array.new(10) + a.fill(o2) + assert_nil(a.rindex(a), bug15951) end def test_shift |