Skip to content

test: add core WeakSet builtin unit tests#4912

Closed
mrhapile wants to merge 3 commits intoboa-dev:mainfrom
mrhapile:test/weakset-core-tests
Closed

test: add core WeakSet builtin unit tests#4912
mrhapile wants to merge 3 commits intoboa-dev:mainfrom
mrhapile:test/weakset-core-tests

Conversation

@mrhapile
Copy link
Copy Markdown
Contributor

@mrhapile mrhapile commented Mar 7, 2026

This PR introduces initial unit tests for the WeakSet builtin.

Currently the WeakSet implementation relies entirely on test262 coverage
and does not have internal Rust-level tests in the Boa engine.

This PR adds:

core/engine/src/builtins/weak_set/tests.rs

The following behaviors are tested:

  • WeakSet.prototype.add basic functionality
  • WeakSet.prototype.has
  • WeakSet.prototype.delete
  • add() chaining behavior

These tests follow the same structure used by other builtin tests
such as WeakMap, Map, and Set.

Screenshot 2026-03-07 at 7 02 07 AM

Additional edge case tests will be added in a follow-up PR.

Signed-off-by: mrhapile <allinonegaming3456@gmail.com>
@mrhapile mrhapile requested a review from a team as a code owner March 7, 2026 01:35
Copilot AI review requested due to automatic review settings March 7, 2026 01:35
Copy link
Copy Markdown
Contributor

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 initial Rust-level unit tests for the WeakSet builtin in Boa’s core engine, complementing existing test262 coverage and aligning with the structure used for other builtin tests.

Changes:

  • Introduces core/engine/src/builtins/weak_set/tests.rs with basic behavioral tests for add, has, delete, and add() chaining.
  • Wires the new test module into the WeakSet builtin via #[cfg(test)] mod tests;.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/engine/src/builtins/weak_set/tests.rs Adds initial unit tests covering core WeakSet prototype behaviors.
core/engine/src/builtins/weak_set/mod.rs Registers the new tests submodule under cfg(test).

💡 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,902 49,902 0
Ignored 2,222 2,222 0
Failed 839 839 0
Panics 0 0 0
Conformance 94.22% 94.22% 0.00%

Tested main commit: 11b1cfa7e2bd5c3e2aec2293712dd734ec64bb95
Tested PR commit: a7f9a8205c9973b62a2db2473c456f481f5227c8
Compare commits: 11b1cfa...a7f9a82

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.73%. Comparing base (6ddc2b4) to head (31c0751).
⚠️ Report is 772 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4912       +/-   ##
===========================================
+ Coverage   47.24%   57.73%   +10.49%     
===========================================
  Files         476      556       +80     
  Lines       46892    60739    +13847     
===========================================
+ Hits        22154    35068    +12914     
- Misses      24738    25671      +933     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: mrhapile <allinonegaming3456@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Mar 8, 2026
### This PR expands the WeakSet unit test coverage.

_The initial WeakSet tests introduced basic behavioral tests._
**#4912** 
This PR adds additional ECMAScript edge case coverage.

The following behaviors are now tested:

- Primitive rejection in WeakSet.prototype.add
- Primitive-safe behavior for WeakSet.prototype.has
- Primitive-safe behavior for WeakSet.prototype.delete
- Duplicate object additions

These tests ensure correct handling of **ECMAScript §24.4 WeakSet**
invariants and improve robustness during future refactors.

<img width="816" height="226" alt="Screenshot 2026-03-07 at 7 15 01 AM"
src="https://github.com/user-attachments/assets/713b64e9-3d21-4fd2-9bb9-4384df7755af"
/>


All tests follow the same pattern used by other builtin tests.

---------

Signed-off-by: mrhapile <allinonegaming3456@gmail.com>
@jedel1043
Copy link
Copy Markdown
Member

Superseeded by #4914

@jedel1043 jedel1043 closed this Apr 6, 2026
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