summaryrefslogtreecommitdiffhomepage
path: root/test/t/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-11-16 02:10:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-16 02:10:44 +0900
commit1f554ff8540d61e30d0e649bf80c0ecd27b40ad6 (patch)
tree81dd4166abb3a3f3b7eae5631b8e52af81050ced /test/t/array.rb
parent242b21947102d98aba2fa3db2725b129ca547f20 (diff)
downloadmruby-1f554ff8540d61e30d0e649bf80c0ecd27b40ad6.tar.gz
mruby-1f554ff8540d61e30d0e649bf80c0ecd27b40ad6.zip
Fixed rindex calling into mrb_equal bug
Fixed by Alex Snaps and reported by Mathieu Leduc-Hamel, both from shopify.com. Thank you!
Diffstat (limited to 'test/t/array.rb')
-rw-r--r--test/t/array.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index 538ea0c3f..d887c117b 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -347,3 +347,15 @@ assert("Array (Longish inline array)") do
ary.each {|p| h[p.class] += 1}
assert_equal({Array=>200}, h)
end
+
+assert("Array#rindex") do
+ class Sneaky
+ def ==(*)
+ $a.clear
+ $a.replace([1])
+ false
+ end
+ end
+ $a = [2, 3, 4, 5, 6, 7, 8, 9, 10, Sneaky.new]
+ assert_equal 0, $a.rindex(1)
+end