Skip to content

test: add coverage for JsTypedArray toReversed, toSorted, toLocaleString#5133

Open
Xavrir wants to merge 4 commits intoboa-dev:mainfrom
Xavrir:test/typed-array-missing-coverage
Open

test: add coverage for JsTypedArray toReversed, toSorted, toLocaleString#5133
Xavrir wants to merge 4 commits intoboa-dev:mainfrom
Xavrir:test/typed-array-missing-coverage

Conversation

@Xavrir
Copy link

@Xavrir Xavrir commented Mar 18, 2026

Context

These three JsTypedArray wrapper methods are fully implemented but had no test coverage. This PR adds unit tests for each.

Ref #3252 -- the tracking issue checkboxes for toLocaleString, toReversed, and toSorted can be checked off, since the implementations already exist in both the builtins layer and the Rust wrapper.

Tests added

  • typed_array_to_reversed -- verifies toReversed() returns a new reversed array and leaves the original unchanged
  • typed_array_to_sorted -- verifies toSorted() returns a new sorted array and leaves the original unchanged
  • typed_array_to_locale_string -- verifies toLocaleString() returns a string containing the element values

All three tests pass locally: cargo test --package boa_engine typed_array_to_

These methods were already implemented in both the builtins layer
and the JsTypedArray wrapper but had no test coverage. Add three
tests that verify:

- toReversed returns a new reversed array without mutating the original
- toSorted returns a new sorted array without mutating the original
- toLocaleString returns a string containing the element values

Ref boa-dev#3252
@Xavrir Xavrir requested a review from a team as a code owner March 18, 2026 15:16
@github-actions github-actions bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 18, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 18, 2026
@github-actions github-actions bot added the C-Builtins PRs and Issues related to builtins/intrinsics label Mar 18, 2026
@github-actions
Copy link

github-actions bot commented Mar 18, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,073 50,073 0
Ignored 2,072 2,072 0
Failed 818 818 0
Panics 0 0 0
Conformance 94.54% 94.54% 0.00%

Tested main commit: 509adef0957d018b51a280d4b4804714e8731dbb
Tested PR commit: 375b13c5ef075f10746f5e6920915625d499ca5a
Compare commits: 509adef...375b13c

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Thanks!

@jedel1043 jedel1043 linked an issue Mar 18, 2026 that may be closed by this pull request
39 tasks
@jedel1043 jedel1043 enabled auto-merge March 18, 2026 17:43
@Xavrir
Copy link
Author

Xavrir commented Mar 18, 2026

no prob! happy to contribute

@jedel1043 jedel1043 disabled auto-merge March 18, 2026 17:53
@jedel1043 jedel1043 enabled auto-merge March 18, 2026 17:53
auto-merge was automatically disabled March 18, 2026 18:17

Head branch was pushed to by a user without write access

@jedel1043 jedel1043 enabled auto-merge March 18, 2026 18:22
@jedel1043 jedel1043 disabled auto-merge March 18, 2026 18:23

#[test]
fn typed_array_iterator() {
fn typed_array_to_reversed() {
Copy link
Member

Choose a reason for hiding this comment

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

I think you deleted the typed_array_iterator test. Can you add that back?

Copy link
Author

Choose a reason for hiding this comment

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

So sorry about that, adding it back asap

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 375b13c. I restored typed_array_iterator and reran cargo test -p boa_engine typed_array_ plus cargo make run-ci locally.

Restore the typed_array_iterator unit test that was accidentally dropped while adding JsTypedArray coverage.

Review comment: 2955394192
@Xavrir Xavrir requested a review from jedel1043 March 18, 2026 19:05
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.50%. Comparing base (6ddc2b4) to head (375b13c).
⚠️ Report is 886 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5133       +/-   ##
===========================================
+ Coverage   47.24%   59.50%   +12.26%     
===========================================
  Files         476      580      +104     
  Lines       46892    63160    +16268     
===========================================
+ Hits        22154    37586    +15432     
- Misses      24738    25574      +836     

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

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

Labels

C-Builtins PRs and Issues related to builtins/intrinsics Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for implemented methods on JsTypedArray

2 participants