summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-07-18 11:00:58 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-07-18 14:52:37 -0400
commitecbedf9bf125b158c683dd6f69ce966653cc9a33 (patch)
tree7e2084fa54a0d5144e89ef24defd24fa4baa2ea6
parent4c03eab1aaa30ada3819930ae4e5f22ee534cb23 (diff)
Remove assumption about object order
The address of objects can't be assumed since a later object may be allocate in a swept slot.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8092
-rw-r--r--test/objspace/test_objspace.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 4757c26630..7edf6be930 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -632,7 +632,13 @@ class TestObjSpace < Test::Unit::TestCase
end
end
- entry_hash = JSON.parse(test_string_in_dump_all[1])
+ strs = test_string_in_dump_all.reject do |s|
+ s.include?("fstring")
+ end
+
+ assert_equal(1, strs.length)
+
+ entry_hash = JSON.parse(strs[0])
assert_equal(5, entry_hash["bytesize"], "bytesize is wrong")
assert_equal("TEST2", entry_hash["value"], "value is wrong")