From a28a060db41415c1c1dad3e554ff2c865a20ebca Mon Sep 17 00:00:00 2001 From: glass Date: Sun, 4 Nov 2012 02:44:58 +0000 Subject: * array.c (recursive_equal): fix to return true when self and other are resized to same size and the current index become out of range. * test/ruby/test_array.rb: add a test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index b4115ac5dd..845a05089a 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1923,6 +1923,20 @@ class TestArray < Test::Unit::TestCase assert_not_equal([0, 1, 2], [0, 1, 3]) end + A = Array.new(3, &:to_s) + B = A.dup + + def test_equal_resize + o = Object.new + def o.==(o) + A.clear + B.clear + true + end + A[1] = o + assert_equal(A, B) + end + def test_hash2 a = [] a << a -- cgit v1.2.3