Skip to content

Add test coverage for WeakGc::new_in constructor#36

Open
mrhapile wants to merge 2 commits intoboa-dev:mainfrom
mrhapile:tests/add-weakgc-behavior-tests
Open

Add test coverage for WeakGc::new_in constructor#36
mrhapile wants to merge 2 commits intoboa-dev:mainfrom
mrhapile:tests/add-weakgc-behavior-tests

Conversation

@mrhapile
Copy link
Contributor

@mrhapile mrhapile commented Mar 6, 2026

This PR adds a unit test covering the WeakGc constructor.

Currently, oscars/src/collectors/mark_sweep/pointers/weak.rs has
0% test coverage. The WeakGc::new_in constructor is the only
executable code in the file but is not exercised by existing tests.
Screenshot 2026-03-06 at 10 14 03 PM

This PR introduces a minimal test verifying that a WeakGc can be
created from a strong Gc reference. Running this test executes
all lines inside WeakGc::new_in.

Coverage impact:

Before:
weak.rs → 0%

After:
weak.rs → ~100%

Screenshot 2026-03-06 at 10 23 15 PM

No changes to GC implementation are introduced. This PR only
adds test coverage for existing behavior.

Copilot AI review requested due to automatic review settings March 6, 2026 16:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a minimal unit test to exercise WeakGc::new_in so oscars/src/collectors/mark_sweep/pointers/weak.rs is covered by the mark-sweep collector test suite.

Changes:

  • Add a new weak_gc_tests module with a test that constructs a WeakGc from a strong Gc.
  • Execute WeakGc::new_in in tests to eliminate previously uncovered lines in weak.rs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@mrhapile
Copy link
Contributor Author

mrhapile commented Mar 7, 2026

Screenshot 2026-03-07 at 5 48 37 PM

@mrhapile mrhapile requested a review from nekevss March 7, 2026 12:30
@mrhapile
Copy link
Contributor Author

mrhapile commented Mar 7, 2026

@nekevss can u give a quick review : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants