Harden TestObjSpace#test_memsize_of_root_shared_string
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.
each_object
By just inverting the operands of == we ensure it's always String#== that is called.
String#==
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'
Harden
TestObjSpace#test_memsize_of_root_shared_stringThis 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_objectit's best to not assume returned objectdare functional.
By just inverting the operands of
==we ensure it's alwaysString#==that is called.