ruby / ruby/spec

core/class/descendants_spec relying on a particular GC behavior

Open
#903 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
622
Forks
402
Avg merge
14h 51m
Merged PRs (30d)
6

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read core/class/descendants_spec.rb at the cited line and compare it with core/module/remove_method_spec.rb. Determine whether the specs should depend on GC running between tests, then update the relevant specification once the expected behavior across Ruby implementations is agreed; done means the test no longer relies on an unsuitable GC assumption.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.