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

RAB: Integrate staging tests for the .toLocaleString method #4178

Merged
merged 5 commits into from
Aug 14, 2024

Conversation

ioannad
Copy link
Contributor

@ioannad ioannad commented Jul 30, 2024

of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier. Includes changes to use the helper ./harness/resizableArrayBufferUtils.js

@ioannad ioannad requested a review from a team as a code owner July 30, 2024 00:34
Comment on lines 32 to 35
assert.sameValue(Array.prototype.toLocaleString.call(fixedLength), '0,2,4,6');
assert.sameValue(Array.prototype.toLocaleString.call(fixedLengthWithOffset), '4,6');
assert.sameValue(Array.prototype.toLocaleString.call(lengthTracking), '0,2,4,6');
assert.sameValue(Array.prototype.toLocaleString.call(lengthTrackingWithOffset), '4,6');
Copy link
Contributor

Choose a reason for hiding this comment

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

As per https://tc39.es/ecma262/#sec-array.prototype.tolocalestring, we are assuming the separator is "," even though it's implementation-defined.

In fact, the spec text itself suggests using ", " with a space. Engine262 does this, while all other engines that I tested use "," without a space.

I think we might have to write these tests to be a bit more agnostic to the localized output.

Note you can get the separator by using [undefined,undefined].toLocaleString(), and we should also call toLocaleString with the argument "en-u-nu-latn" to ensure that we get the right digit representations regardless of the locale in which the tests are executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was unsure about whether to still pass en-u-nu-latn to each invocation of toLocaleString like I suggested above. In the end I think it's OK not to; it would clutter up the tests quite a bit and I am sure there are a bunch of other existing tests that would fail if the default locale wasn't en.

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

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

LGTM after shortening listToString

ioannad and others added 5 commits August 14, 2024 12:22
…des,

while applying review changes from PRs for previously tested methods.
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
@ptomato ptomato force-pushed the RAB-test-method-toLocaleString branch from d13f304 to 55f5e11 Compare August 14, 2024 19:22
@ptomato ptomato merged commit b1d0933 into tc39:main Aug 14, 2024
8 checks passed
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.

2 participants