diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-03-06 08:09:57 +0100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-03-06 08:42:01 +0100 |
| commit | ca4325f6c9710ae5dcda9f735b264ba92bffb68f (patch) | |
| tree | 16f2898ad07e88817f92d3dbeb3e9f0373c5663b /test/ruby/test_array.rb | |
| parent | c939d0c85d1da76477a268058689f2f65e02d4be (diff) | |
Harden `TestObjSpace#test_memsize_of_root_shared_string`
This test occasionally fail because it runs into a String instance
that had its `==` method removed.
I couldn't identify where this String comes from, but in general
when using `each_object` it's best to not assume returned objectd
are functional.
By just inverting the operands of `==` we ensure it's always
`String#==` that is called.
```
1) Error:
TestObjSpace#test_memsize_of_root_shared_string:
NoMethodError: undefined method '==' for #<String:0x00007f9b50e8c978>
/tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'block in TestObjSpace#test_memsize_of_root_shared_string'
/tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'ObjectSpace.each_object'
/tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'TestObjSpace#test_memsize_of_root_shared_string'
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12870
Diffstat (limited to 'test/ruby/test_array.rb')
0 files changed, 0 insertions, 0 deletions
