mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 12:34:21 +00:00
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}}
```
This commit is contained in:
parent
8b3280bebd
commit
e82138e48a
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user