spec icon indicating copy to clipboard operation
spec copied to clipboard

core/class/descendants_spec relying on a particular GC behavior

Open hmdne opened this issue 4 years ago • 1 comments

I'm implementing Class#{subclasses,descendants} in Opal. While in MRI GC may run quite consistently for this test to always pass, in Opal we have to rely on JS behavior - and it doesn't help us. A similar situation may happen on other Ruby implementations.

Let's take a look at this:

https://github.com/ruby/spec/blob/12c704ac53d4200610d48c50e0e5d1c4dd40aa82/core/class/descendants_spec.rb#L7

And then this:

https://github.com/ruby/spec/blob/12c704ac53d4200610d48c50e0e5d1c4dd40aa82/core/module/remove_method_spec.rb#L37

A question would be - do we really want to hardcode a need for GC for this part or an assumption that it will be ran between those 2 tests?

hmdne avatar Dec 08 '21 17:12 hmdne

Of course not, it's unintentional. Could you make a PR to fix it? I think it's best to use a separate hierarchy for the descendants/subclasses specs to avoid unintentional subclasses like that one.

eregon avatar Dec 08 '21 17:12 eregon