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.

Assessment

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

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.

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?

Dominant language
Ruby
Stars
623
Forks
403
Avg merge
10h 38m
Merged PRs (30d)
5

Getting set up

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.

More from ruby/spec

All issues in ruby/spec

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.