-
Notifications
You must be signed in to change notification settings - Fork 479
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
Account for the use of ToIndex in Atomic operations #870
Conversation
harness/testAtomics.js
Outdated
(view) => undefined, // 0 | ||
(view) => Number.NaN, // 0 | ||
(view) => 3.5, | ||
(view) => '3.5', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the length is 3 or more this will fail.
0.5
and '0.5'
should avoid this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean, if the length is 3 or less this will fail? I'll change this to 0.5 which has the same effect for me, but may still fail if the length is zero. I'll add a comment stipulating the minimum expected length.
harness/testAtomics.js
Outdated
(view) => Number.NaN, // 0 | ||
(view) => 3.5, | ||
(view) => '3.5', | ||
(view) => ({ password: "qumquat" }), | ||
(view) => view.length - 1, | ||
(view) => ({ valueOf: () => 0 }), | ||
(view) => ({ toString: () => '0', valueOf: false }) // non-callable valueOf triggers invocation of toString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can include false
to improve coverage for the ToIndex operation here.
-0.9
should work as a good index as well, weird, but it works.
harness/testAtomics.js
Outdated
@@ -44,6 +39,11 @@ function testWithAtomicsInBoundsIndices(f) { | |||
var good_indices = [ | |||
(view) => 0/-1, // -0 | |||
(view) => '-0', | |||
(view) => undefined, // 0 | |||
(view) => Number.NaN, // 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the regular global NaN
should do the trick as well, but it's not necessary to do change this.
@@ -33,16 +33,20 @@ function testWithAtomicsOutOfBoundsIndices(f) { | |||
* Calls the provided function for each good index that should not throw when | |||
* passed to an Atomics method on a SAB-backed view. | |||
* | |||
* The view must have length greater than zero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
These test changes pertain to the spec change in tc39/ecma262#807.