From e82138e48a7ff152e358ce37fdae07e989fe5ee3 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 9 May 2024 11:38:07 +0200 Subject: Stabilize TestObjSpace#test_dump_special_consts The test assumes `:foo` is a static symbol, but that is only true if a literal `:foo` was parsed before `"foo".to_sym` was evaled: ```ruby require 'objspace' foo_sym = "foo".to_sym puts ObjectSpace.dump(eval(":foo")) ``` ``` {"address":"0x100fb46d0", "type":"SYMBOL", "shape_id":10, "slot_size":40, "class":"0x100d3e9c8", "frozen":true, "bytesize":3, "value":"foo", "memsize":40, "flags":{"wb_protected":true, "marking":true, "marked":true}} ``` --- test/objspace/test_objspace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index b798b897b4..17f73e4433 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -416,7 +416,7 @@ class TestObjSpace < Test::Unit::TestCase assert_equal('true', ObjectSpace.dump(true)) assert_equal('false', ObjectSpace.dump(false)) assert_equal('0', ObjectSpace.dump(0)) - assert_equal('{"type":"SYMBOL", "value":"foo"}', ObjectSpace.dump(:foo)) + assert_equal('{"type":"SYMBOL", "value":"test_dump_special_consts"}', ObjectSpace.dump(:test_dump_special_consts)) end def test_dump_singleton_class -- cgit v1.2.3