From c98d1f182d1b5870272e25b7e636b49849f2c71c Mon Sep 17 00:00:00 2001 From: tenderlove Date: Sat, 20 Apr 2019 04:13:29 +0000 Subject: [PATCH] add more assertions around moved object git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc_compact.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index 0fc27a287a..09b8d9d477 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -76,7 +76,14 @@ class TestGCCompact < Test::Unit::TestCase list_of_objects, addresses, new_tenant = try_to_move_objects # This is the object that used to be in new_object's position - previous_tenant = list_of_objects[addresses.index(memory_location(new_tenant))] + loc = memory_location(new_tenant) + assert loc, "should have a memory location" + + address_idx = addresses.index(loc) + assert address_idx, "should have an address index" + + previous_tenant = list_of_objects[address_idx] + assert previous_tenant, "should have a previous tenant" assert_not_equal previous_tenant.object_id, new_tenant.object_id