Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Array.join when the array contains itself #3406

Merged
merged 2 commits into from
Oct 21, 2023

Conversation

ahaoboy
Copy link
Contributor

@ahaoboy ahaoboy commented Oct 21, 2023

The documentation doesn't specify how the join function should handle cases where the array contains itself, but other engines treat it as an empty string.

let b = []
b[0] = b;
b[1] = b;
b[2] = b;

// expect output: ",,"
console.log(b.join(','))

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (26d14a8) 45.65% compared to head (3c6556a) 45.65%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3406   +/-   ##
=======================================
  Coverage   45.65%   45.65%           
=======================================
  Files         483      483           
  Lines       49498    49498           
=======================================
  Hits        22600    22600           
  Misses      26898    26898           
Files Coverage Δ
boa_engine/src/builtins/array/mod.rs 76.34% <100.00%> (+0.09%) ⬆️

... and 2 files with indirect coverage changes

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

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

It seems there are no Test262 tests for this behavior, so we should add a Rust test

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 for the contribution!

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

@HalidOdat HalidOdat added this pull request to the merge queue Oct 21, 2023
Merged via the queue into boa-dev:main with commit caac904 Oct 21, 2023
14 checks passed
sam-finch-tezos pushed a commit to trilitech/boa that referenced this pull request Nov 29, 2023
* Fix Array.join when the array contains itself

* add test
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.

4 participants