From 6d8ab9c35ecc40b65e7600d626599d2bef000ee1 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 8 Oct 2020 15:56:06 -0400 Subject: [PATCH] Coverage: more Atomics.waitAsync tests, fixes, improved messages. --- harness/atomicsHelper.js | 2 + .../Atomics/wait/false-for-timeout.js | 4 +- test/built-ins/Atomics/waitAsync/bad-range.js | 4 +- .../Atomics/waitAsync/bigint/bad-range.js | 4 +- .../bigint/false-for-timeout-agent.js | 22 ++++++----- .../waitAsync/bigint/false-for-timeout.js | 14 +++---- .../Atomics/waitAsync/bigint/good-views.js | 8 ++-- .../waitAsync/bigint/nan-for-timeout-agent.js | 13 +++++-- .../waitAsync/bigint/negative-index-throws.js | 10 ++--- .../bigint/negative-timeout-agent.js | 12 ++++-- .../waitAsync/bigint/negative-timeout.js | 8 +--- .../bigint/no-spurious-wakeup-no-operation.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-add.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-and.js | 15 ++++---- .../no-spurious-wakeup-on-compareExchange.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-exchange.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-or.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-store.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-sub.js | 15 ++++---- .../bigint/no-spurious-wakeup-on-xor.js | 15 ++++---- .../bigint/non-bigint64-typedarray-throws.js | 4 +- .../bigint/non-shared-bufferdata-throws.js | 6 +-- .../bigint/not-a-typedarray-throws.js | 7 ++-- .../waitAsync/bigint/not-an-object-throws.js | 16 ++++---- .../bigint/null-bufferdata-throws.js | 4 +- .../bigint/null-for-timeout-agent.js | 22 ++++++----- .../waitAsync/bigint/null-for-timeout.js | 19 ++-------- .../bigint/object-for-timeout-agent.js | 22 ++++++----- .../waitAsync/bigint/object-for-timeout.js | 14 +++---- .../bigint/out-of-range-index-throws.js | 10 ++--- ...oisoned-object-for-timeout-throws-agent.js | 14 ++++--- .../poisoned-object-for-timeout-throws.js | 6 +-- .../bigint/symbol-for-index-throws-agent.js | 14 ++++--- .../bigint/symbol-for-index-throws.js | 10 ++--- .../bigint/symbol-for-timeout-throws-agent.js | 14 ++++--- .../bigint/symbol-for-timeout-throws.js | 10 ++--- .../bigint/symbol-for-value-throws-agent.js | 14 ++++--- .../bigint/symbol-for-value-throws.js | 10 ++--- .../bigint/true-for-timeout-agent.js | 16 +++++--- .../waitAsync/bigint/true-for-timeout.js | 32 +++++++++++++--- .../bigint/undefined-for-timeout-agent.js | 10 +++-- .../waitAsync/bigint/undefined-for-timeout.js | 24 ++++-------- .../undefined-index-defaults-to-zero-agent.js | 10 +++-- .../waitAsync/bigint/value-not-equal-agent.js | 10 ++--- .../waitAsync/bigint/value-not-equal.js | 6 +-- .../waiterlist-block-indexedposition-wake.js | 20 ++++++---- .../bigint/was-woken-before-timeout.js | 26 ++++++++----- .../waitAsync/false-for-timeout-agent.js | 18 ++++----- .../Atomics/waitAsync/false-for-timeout.js | 14 +++---- .../built-ins/Atomics/waitAsync/good-views.js | 8 ++-- .../implicit-infinity-for-timeout.js | 38 +++++++++++++++++++ .../Atomics/waitAsync/is-function.js | 2 +- .../waitAsync/nan-for-timeout-agent.js | 8 ++-- .../waitAsync/negative-index-throws.js | 10 ++--- .../waitAsync/negative-timeout-agent.js | 8 ++-- .../Atomics/waitAsync/negative-timeout.js | 4 +- .../no-spurious-wakeup-no-operation.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-add.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-and.js | 10 ++--- .../no-spurious-wakeup-on-compareExchange.js | 10 ++--- .../no-spurious-wakeup-on-exchange.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-or.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-store.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-sub.js | 10 ++--- .../waitAsync/no-spurious-wakeup-on-xor.js | 10 ++--- .../waitAsync/non-int32-typedarray-throws.js | 18 ++++----- .../waitAsync/non-shared-bufferdata-throws.js | 6 +-- .../waitAsync/not-a-typedarray-throws.js | 6 +-- .../Atomics/waitAsync/not-an-object-throws.js | 16 ++++---- .../waitAsync/null-bufferdata-throws.js | 4 +- .../waitAsync/null-for-timeout-agent.js | 18 ++++----- .../Atomics/waitAsync/null-for-timeout.js | 19 ++-------- .../waitAsync/object-for-timeout-agent.js | 18 ++++----- .../Atomics/waitAsync/object-for-timeout.js | 14 +++---- .../waitAsync/out-of-range-index-throws.js | 10 ++--- ...oisoned-object-for-timeout-throws-agent.js | 10 ++--- .../poisoned-object-for-timeout-throws.js | 6 +-- ...-object-value-is-promise-resolves-to-ok.js | 16 +++++--- ...-value-is-promise-resolves-to-timed-out.js | 26 +++++++++---- ...result-object-value-is-string-not-equal.js | 6 +-- ...result-object-value-is-string-timed-out.js | 6 +-- .../symbol-for-index-throws-agent.js | 10 ++--- .../waitAsync/symbol-for-index-throws.js | 10 ++--- .../symbol-for-timeout-throws-agent.js | 10 ++--- .../waitAsync/symbol-for-timeout-throws.js | 10 ++--- .../symbol-for-value-throws-agent.js | 10 ++--- .../waitAsync/symbol-for-value-throws.js | 10 ++--- .../waitAsync/true-for-timeout-agent.js | 12 +++--- .../Atomics/waitAsync/true-for-timeout.js | 30 ++++++++++++--- .../waitAsync/undefined-for-timeout-agent.js | 6 +-- .../waitAsync/undefined-for-timeout.js | 26 ++++--------- .../undefined-index-defaults-to-zero-agent.js | 6 +-- ...alidate-arraytype-before-index-coercion.js | 6 +-- ...idate-arraytype-before-timeout-coercion.js | 6 +-- ...alidate-arraytype-before-value-coercion.js | 6 +-- .../waitAsync/value-not-equal-agent.js | 12 +++--- .../Atomics/waitAsync/value-not-equal.js | 6 +-- .../waiterlist-block-indexedposition-wake.js | 16 ++++---- .../waitAsync/was-woken-before-timeout.js | 18 ++++----- 99 files changed, 655 insertions(+), 560 deletions(-) create mode 100644 test/built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js diff --git a/harness/atomicsHelper.js b/harness/atomicsHelper.js index 1dbff5d4a8..c1e692b8e9 100644 --- a/harness/atomicsHelper.js +++ b/harness/atomicsHelper.js @@ -54,6 +54,8 @@ defines: })(this); } + $262.agent.setTimeout = setTimeout; + $262.agent.getReportAsync = function() { return new Promise(function(resolve) { (function loop() { diff --git a/test/built-ins/Atomics/wait/false-for-timeout.js b/test/built-ins/Atomics/wait/false-for-timeout.js index e722bceaff..3a0d62a3dd 100644 --- a/test/built-ins/Atomics/wait/false-for-timeout.js +++ b/test/built-ins/Atomics/wait/false-for-timeout.js @@ -16,9 +16,7 @@ features: [Atomics, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray] flags: [CanBlockIsTrue] ---*/ -const i32a = new Int32Array( - new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) -); +const i32a = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)); const valueOf = { valueOf: function() { diff --git a/test/built-ins/Atomics/waitAsync/bad-range.js b/test/built-ins/Atomics/waitAsync/bad-range.js index 332cfe4ec3..ced1926a70 100644 --- a/test/built-ins/Atomics/waitAsync/bad-range.js +++ b/test/built-ins/Atomics/waitAsync/bad-range.js @@ -19,7 +19,7 @@ info: | includes: [testAtomics.js] features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) ); @@ -27,7 +27,7 @@ const i32a = new Int32Array( testWithAtomicsOutOfBoundsIndices(function(IdxGen) { assert.throws(RangeError, function() { Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0); - }, '`Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0)` throws RangeError'); + }, '`Atomics.waitAsync(i32a, IdxGen(i32a), 0, 0)` throws a RangeError exception'); }); diff --git a/test/built-ins/Atomics/waitAsync/bigint/bad-range.js b/test/built-ins/Atomics/waitAsync/bigint/bad-range.js index 398dfae844..b58d61e019 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/bad-range.js +++ b/test/built-ins/Atomics/waitAsync/bigint/bad-range.js @@ -18,11 +18,11 @@ info: | includes: [testAtomics.js] features: [Atomics.waitAsync, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Symbol, TypedArray, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)); testWithAtomicsOutOfBoundsIndices(function(IdxGen) { assert.throws(RangeError, function() { Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0); - }, '`Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0)` throws RangeError'); + }, '`Atomics.waitAsync(i64a, IdxGen(i64a), 0n, 0)` throws a RangeError exception'); }); diff --git a/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js index 7ddf025eed..18a924ab07 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js @@ -17,7 +17,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -49,43 +49,47 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout.js index 1768660f3d..4e1e98878f 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/false-for-timeout.js @@ -16,7 +16,7 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const valueOf = { @@ -34,19 +34,19 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, false).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, false).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"' ); Promise.all([ @@ -54,7 +54,7 @@ Promise.all([ Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value ]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); + assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/good-views.js b/test/built-ins/Atomics/waitAsync/bigint/good-views.js index e9a68af751..4b7e91c376 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/good-views.js +++ b/test/built-ins/Atomics/waitAsync/bigint/good-views.js @@ -9,7 +9,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); $262.agent.start(` (async () => { @@ -54,17 +54,17 @@ $262.agent.start(` assert.sameValue( outcomes[0], 'A timed-out', - '"A " + (await Atomics.waitAsync(view, 0, 0n, 0).value resolves to "A timed-out"' + 'The value of outcomes[0] is "A timed-out"' ); assert.sameValue( outcomes[1], 'B not-equal', - '"B " + (await Atomics.waitAsync(view, 0, 37n, 0).value resolves to "B not-equal"' + 'The value of outcomes[1] is "B not-equal"' ); assert.sameValue( outcomes[2], 'C not-equal,not-equal,not-equal,not-equal,not-equal', - 'All C values are not equal' + 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"' ); })().then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js index 9524ae874e..5421184ab6 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js @@ -17,7 +17,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -33,12 +33,17 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); - assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1'); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); + + assert.sameValue( + Atomics.notify(i64a, 0), + 1, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 1' + ); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i64a, 0, 0n, NaN).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/negative-index-throws.js b/test/built-ins/Atomics/waitAsync/bigint/negative-index-throws.js index 39004aa3c7..953a05e373 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/negative-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/negative-index-throws.js @@ -17,7 +17,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array( new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) ); @@ -30,14 +30,14 @@ const poisoned = { assert.throws(RangeError, function() { Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, -Infinity, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, -7.999, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, -7.999, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, -7.999, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, -1, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, -300, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, -300, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, -300, poisoned, poisoned)` throws a RangeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js index 6f691a12da..ac70d120eb 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js @@ -17,7 +17,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -32,13 +32,17 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, -5).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/negative-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/negative-timeout.js index ddd731afa7..bfcf8925d9 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/negative-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/negative-timeout.js @@ -16,13 +16,9 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, destructuring-binding, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); Promise.all([Atomics.waitAsync(i64a, 0, 0n, -1).value]).then(([outcome]) => { - assert.sameValue( - outcome, - 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, -1).value resolves to "timed-out"' - ); + assert.sameValue(outcome, 'timed-out', 'The value of `outcome` is "timed-out"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js index 80505e42e7..328c7192e1 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -46,16 +46,15 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js index 1f7fa4ad07..6e2f2f9f8d 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.add(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js index 6c5146f1bf..e813011c65 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.and(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js index efcacccd76..6e9846cca2 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.compareExchange(i64a, 0, 0n, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js index 6fbb585bc9..f4435b8cde 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.exchange(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js index dece081cfd..1652204a77 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.or(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js index bae57bdea1..a7d1503254 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.store(i64a, 0, 0b1010n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js index 9d47f76409..3b4e5b8f08 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.sub(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js index b95c4bfe88..d46baf22a3 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js +++ b/test/built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -45,17 +45,16 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); Atomics.xor(i64a, 0, 1n); const lapse = await $262.agent.getReportAsync(); - assert(lapse >= TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); + assert(lapse >= TIMEOUT, 'The result of evaluating `(lapse >= TIMEOUT)` is true'); const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'timed-out', 'The value of `result` is "timed-out"'); assert.sameValue( - result, - 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "timed-out"' + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' ); - - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js b/test/built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js index 4352785058..5510ff20d5 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js @@ -21,7 +21,7 @@ info: | features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -31,5 +31,5 @@ const poisoned = { assert.throws(TypeError, () => { const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); Atomics.waitAsync(view, poisoned, poisoned, poisoned);` throws TypeError'); +}, '`const view = new BigUint64Array(new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT * 8)); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/non-shared-bufferdata-throws.js b/test/built-ins/Atomics/waitAsync/bigint/non-shared-bufferdata-throws.js index e6dcbfee43..7a04871948 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/non-shared-bufferdata-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/non-shared-bufferdata-throws.js @@ -20,7 +20,7 @@ info: | features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const poisoned = { @@ -31,8 +31,8 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync(i64a, 0, 0n, 0); -}, '`Atomics.waitAsync(i64a, 0, 0n, 0)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, 0, 0n, 0)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(i64a, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/not-a-typedarray-throws.js b/test/built-ins/Atomics/waitAsync/bigint/not-a-typedarray-throws.js index 4bdeadbd0c..f43cc3e22a 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/not-a-typedarray-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/not-a-typedarray-throws.js @@ -24,7 +24,8 @@ info: | features: [Atomics.waitAsync, arrow-function, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); + const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -33,8 +34,8 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync({}, 0, 0n, 0); -}, '`Atomics.waitAsync({}, 0, 0n, 0)` throws TypeError'); +}, '`Atomics.waitAsync({}, 0, 0n, 0)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync({}, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/not-an-object-throws.js b/test/built-ins/Atomics/waitAsync/bigint/not-an-object-throws.js index 9e68a4336f..1ddd8f5bd8 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/not-an-object-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/not-an-object-throws.js @@ -24,7 +24,7 @@ info: | features: [Atomics.waitAsync, Symbol, arrow-function, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -33,29 +33,29 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync(null, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(undefined, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(true, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(false, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync('***string***', poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(\'***string***\', poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync("***string***", poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(Symbol(\'***symbol***\'), poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(Symbol("***symbol***"), poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js b/test/built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js index c44f51a33e..005ef96599 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js @@ -25,7 +25,7 @@ info: | includes: [detachArrayBuffer.js] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array( new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) ); @@ -44,5 +44,5 @@ try { assert.throws(TypeError, function() { Atomics.waitAsync(i64a, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js index a3f9a82537..6ae7cb31f2 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js @@ -19,7 +19,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -51,43 +51,47 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout.js index 9254340819..6118b32b68 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/null-for-timeout.js @@ -16,9 +16,8 @@ info: | Null -> Return +0. features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function] -flags: [async] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const valueOf = { @@ -36,27 +35,17 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, null).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, null).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, null).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"' ); - -Promise.all([ - Atomics.waitAsync(i64a, 0, 0n, null).value, - Atomics.waitAsync(i64a, 0, 0n, valueOf).value, - Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value -]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); -}).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js index 03d65c8661..f86f17c467 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js @@ -22,7 +22,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -60,43 +60,47 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout.js index 51d40c094d..286ce0ac64 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/object-for-timeout.js @@ -21,7 +21,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt, arrow-function] flags: [async] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const valueOf = { @@ -45,19 +45,19 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, toString).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toString).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, toString).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value is "timed-out"' ); Promise.all([ @@ -65,7 +65,7 @@ Promise.all([ Atomics.waitAsync(i64a, 0, 0n, toString).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value ]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); + assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js b/test/built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js index 00dfff4525..287658be78 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js @@ -20,7 +20,7 @@ info: | 5. If accessIndex ≥ length, throw a RangeError exception. features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array( new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) ); @@ -33,14 +33,14 @@ const poisoned = { assert.throws(RangeError, function() { Atomics.waitAsync(i64a, Infinity, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, Infinity, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, Infinity, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, -1, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, -1, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, 4, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, 4, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, 4, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i64a, 200, poisoned, poisoned); -}, '`Atomics.waitAsync(i64a, 200, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i64a, 200, poisoned, poisoned)` throws a RangeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js b/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js index 8c682f6ac1..f95c06fd7a 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js @@ -20,7 +20,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -63,19 +63,23 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'poisonedValueOf', - 'Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf) throws' + '(await $262.agent.getReportAsync()) resolves to the value "poisonedValueOf"' ); assert.sameValue( await $262.agent.getReportAsync(), 'poisonedToPrimitive', - 'Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive) throws' + '(await $262.agent.getReportAsync()) resolves to the value "poisonedToPrimitive"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js b/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js index 43d3810b48..b5c2e3d4b2 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js @@ -18,7 +18,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const poisonedValueOf = { @@ -35,8 +35,8 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf); -}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws a Test262Error exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js index 7c64fc050c..b5ef65fba7 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js @@ -32,7 +32,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -75,19 +75,23 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i64a, Symbol("1"), ..., ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i64a, Symbol("2"), ..., ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js index 79455fc758..ea1a49d76f 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js @@ -31,7 +31,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array( new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) ); @@ -50,19 +50,19 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, Symbol('1'), poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i64a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js index a801ab6970..6fb16c96fd 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js @@ -19,7 +19,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -50,19 +50,23 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i64a, 0, 0n, Symbol("1")) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i64a, 0, 0n, Symbol("2")) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js index 556b63d0f2..9400f8c2c6 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js @@ -17,7 +17,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const poisonedValueOf = { @@ -34,16 +34,16 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf); -}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, 0n, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, 0, 0n, Symbol('foo')); -}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws TypeError'); +}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, 0, 0n, Symbol('foo')); -}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws TypeError'); +}, '`Atomics.waitAsync(i64a, 0, 0n, Symbol("foo"))` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js index 40be1da354..507b7e5e73 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js @@ -23,7 +23,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -66,19 +66,23 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i64a, 0, Symbol("1"), ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i64a, 0, Symbol("2"), ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js index 5d08ad2f21..6f36dd196b 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js +++ b/test/built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js @@ -22,7 +22,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, BigInt] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array( new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4) ); @@ -41,17 +41,17 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i64a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf); -}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedValueOf)` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive); -}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive)` throws TypeError'); +}, '`Atomics.waitAsync(i64a, 0, Symbol("foo"), poisonedToPrimitive)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js index d38239e4ab..2bd1fee77a 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js @@ -17,7 +17,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; $262.agent.start(` @@ -46,25 +46,29 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout.js index 2148544962..c535b40c59 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/true-for-timeout.js @@ -16,9 +16,10 @@ info: | Boolean -> If argument is true, return 1. If argument is false, return +0. flags: [async] +includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const valueOf = { @@ -33,12 +34,31 @@ const toPrimitive = { } }; +let outcomes = []; +let lifespan = 1000; +let start = $262.agent.monotonicNow(); + +(function wait() { + let elapsed = $262.agent.monotonicNow() - start; + + if (elapsed > lifespan) { + $DONE('Test timed out'); + return; + } + + if (outcomes.length) { + assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"'); + $DONE(); + return; + } + + $262.agent.setTimeout(wait, 0); +})(); + Promise.all([ Atomics.waitAsync(i64a, 0, 0n, true).value, Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value -]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); -}).then($DONE, $DONE); +]).then(results => outcomes = results, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js index e8bf873474..64636d7e3c 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js @@ -22,7 +22,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const WAIT_INDEX = 0; const RUNNING = 1; @@ -57,12 +57,16 @@ const i64a = new BigInt64Array( $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { - assert.sameValue(agentCount, BigInt(NUMAGENT)); + assert.sameValue( + agentCount, + BigInt(NUMAGENT), + 'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)' + ); assert.sameValue( Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT), NOTIFYCOUNT, - 'Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT' ); const reports = [ diff --git a/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js index 77d25cfe78..43500c09e7 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js @@ -18,23 +18,11 @@ info: | 5.If q is NaN, let t be +∞, else let t be max(q, 0) flags: [async] -includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); -$262.agent.start(` - $262.agent.receiveBroadcast(async (sab) => { - var i64a = new BigInt64Array(sab); - $262.agent.sleep(1000); - Atomics.notify(i64a, 0, 4); - $262.agent.leaving(); - }); -`); - -$262.agent.safeBroadcast(i64a); - const valueOf = { valueOf() { return undefined; @@ -53,8 +41,10 @@ Promise.all([ Atomics.waitAsync(i64a, 0, 0n, valueOf).value, Atomics.waitAsync(i64a, 0, 0n, toPrimitive).value ]).then(outcomes => { - assert.sameValue(outcomes[0], 'ok'); - assert.sameValue(outcomes[1], 'ok'); - assert.sameValue(outcomes[2], 'ok'); - assert.sameValue(outcomes[3], 'ok'); + assert.sameValue(outcomes[0], 'ok', 'The value of outcomes[0] is "ok"'); + assert.sameValue(outcomes[1], 'ok', 'The value of outcomes[1] is "ok"'); + assert.sameValue(outcomes[2], 'ok', 'The value of outcomes[2] is "ok"'); + assert.sameValue(outcomes[3], 'ok', 'The value of outcomes[3] is "ok"'); }).then($DONE, $DONE); + +Atomics.notify(i64a, 0); diff --git a/test/built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js b/test/built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js index 662c8741c6..9bd1b36799 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js @@ -26,7 +26,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const WAIT_INDEX = 0; const RUNNING = 1; @@ -59,12 +59,16 @@ const i64a = new BigInt64Array( $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { - assert.sameValue(agentCount, BigInt(NUMAGENT)); + assert.sameValue( + agentCount, + BigInt(NUMAGENT), + 'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)' + ); assert.sameValue( Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT), NOTIFYCOUNT, - 'Atomics.notify(i64a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT' ); const reports = [ diff --git a/test/built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js b/test/built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js index 1e8d5b1c37..be49407f64 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js +++ b/test/built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js @@ -23,7 +23,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const value = 42n; @@ -40,23 +40,23 @@ $262.agent.start(` const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( await $262.agent.getReportAsync(), value.toString(), - 'Atomics.store(i64a, 0, 42n) returns 42' + '(await $262.agent.getReportAsync()) must return the same value returned by value.toString()' ); assert.sameValue( await $262.agent.getReportAsync(), 'not-equal', - 'Atomics.waitAsync(i64a, 0, 0n).value resolves to "not-equal"' + '(await $262.agent.getReportAsync()) resolves to the value "not-equal"' ); assert.sameValue( Atomics.notify(i64a, 0, 1), 0, - 'Atomics.notify(i64a, 0, 1) returns 0 (nothing to notify)' + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0, 1) must return 0' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/value-not-equal.js b/test/built-ins/Atomics/waitAsync/bigint/value-not-equal.js index 04dec28085..fb12953b2b 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/value-not-equal.js +++ b/test/built-ins/Atomics/waitAsync/bigint/value-not-equal.js @@ -22,7 +22,7 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, BigInt, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); const valueOf = { @@ -38,6 +38,6 @@ const toPrimitive = { }; Promise.all([Atomics.store(i64a, 0, 42n), Atomics.waitAsync(i64a, 0, 0n).value]).then(outcomes => { - assert.sameValue(outcomes[0], 42n); - assert.sameValue(outcomes[1], 'not-equal'); + assert.sameValue(outcomes[0], 42n, 'The value of outcomes[0] is 42n'); + assert.sameValue(outcomes[1], 'not-equal', 'The value of outcomes[1] is "not-equal"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js b/test/built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js index f4617aaa2b..90fc56cb56 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js +++ b/test/built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const NUMAGENT = 2; const RUNNING = 4; @@ -57,28 +57,32 @@ const i64a = new BigInt64Array( $262.agent.safeBroadcastAsync(i64a, RUNNING, BigInt(NUMAGENT)).then(async (agentCount) => { - assert.sameValue(agentCount, BigInt(NUMAGENT)); + assert.sameValue( + agentCount, + BigInt(NUMAGENT), + 'The value of `agentCount` must return the same value returned by BigInt(NUMAGENT)' + ); // Notify index 1, notifies nothing - assert.sameValue(Atomics.notify(i64a, 1), 0, 'Atomics.notify(i64a, 1) returns 0'); + assert.sameValue(Atomics.notify(i64a, 1), 0, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 1) must return 0'); // Notify index 3, notifies nothing - assert.sameValue(Atomics.notify(i64a, 3), 0, 'Atomics.notify(i64a, 3) returns 0'); + assert.sameValue(Atomics.notify(i64a, 3), 0, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 3) must return 0'); // Notify index 2, notifies 1 - assert.sameValue(Atomics.notify(i64a, 2), 1, 'Atomics.notify(i64a, 2) returns 1'); + assert.sameValue(Atomics.notify(i64a, 2), 1, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 2) must return 1'); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i64a, 0, 0n, Infinity).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); // Notify index 0, notifies 1 - assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1'); + assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)), 0) must return 1'); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i64a, 2, 0n, Infinity).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js b/test/built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js index 3f4a7f1ff3..c095fa1b7f 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js +++ b/test/built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js @@ -9,7 +9,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.huge; const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)); @@ -30,17 +30,23 @@ $262.agent.start(` `); $262.agent.safeBroadcastAsync(i64a, RUNNING, 1n).then(async agentCount => { - assert.sameValue(agentCount, 1n); - assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1'); - const lapse = await $262.agent.getReportAsync(); - assert(lapse < TIMEOUT, 'The result of `(lapse >= TIMEOUT)` is true'); - const result = await $262.agent.getReportAsync(); + assert.sameValue(agentCount, 1n, 'The value of `agentCount` is 1n'); assert.sameValue( - result, - 'ok', - 'await Atomics.waitAsync(i64a, 0, 0n, ${TIMEOUT}).value resolves to "ok"' + Atomics.notify(i64a, 0), + 1, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 1' ); - assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0'); + const lapse = await $262.agent.getReportAsync(); + assert(lapse < TIMEOUT, 'The result of evaluating `(lapse < TIMEOUT)` is true'); + const result = await $262.agent.getReportAsync(); + assert.sameValue(result, 'ok', 'The value of `result` is "ok"'); + assert.sameValue(result, 'ok', 'The value of `result` is "ok"'); + + assert.sameValue( + Atomics.notify(i64a, 0), + 0, + 'Atomics.notify(new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)), 0) must return 0' + ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js index 09c1cd3725..da9651df2d 100644 --- a/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/false-for-timeout-agent.js @@ -18,7 +18,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -53,40 +53,40 @@ const i32a = new Int32Array( ); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/false-for-timeout.js b/test/built-ins/Atomics/waitAsync/false-for-timeout.js index ed2228658f..8fc5cf9a5b 100644 --- a/test/built-ins/Atomics/waitAsync/false-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/false-for-timeout.js @@ -17,7 +17,7 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -37,19 +37,19 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i32a, 0, 0, false).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, false).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"' ); Promise.all([ @@ -57,7 +57,7 @@ Promise.all([ Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, ]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); + assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/good-views.js b/test/built-ins/Atomics/waitAsync/good-views.js index ba97dbd00e..ddb1c3600b 100644 --- a/test/built-ins/Atomics/waitAsync/good-views.js +++ b/test/built-ins/Atomics/waitAsync/good-views.js @@ -9,7 +9,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); $262.agent.start(` (async () => { @@ -53,17 +53,17 @@ $262.agent.start(` assert.sameValue( outcomes[0], 'A timed-out', - '"A " + (await Atomics.waitAsync(view, 0, 0, 0).value resolves to "A timed-out"' + 'The value of outcomes[0] is "A timed-out"' ); assert.sameValue( outcomes[1], 'B not-equal', - '"B " + (await Atomics.waitAsync(view, 0, 37, 0).value resolves to "B not-equal"' + 'The value of outcomes[1] is "B not-equal"' ); assert.sameValue( outcomes[2], 'C not-equal,not-equal,not-equal,not-equal,not-equal', - 'All C values are not equal' + 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"' ); })().then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js b/test/built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js new file mode 100644 index 0000000000..59fb382f25 --- /dev/null +++ b/test/built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atomics.waitasync +description: > + Undefined timeout arg is coerced to zero +info: | + Atomics.waitAsync( typedArray, index, value, timeout ) + + 1. Return DoWait(async, typedArray, index, value, timeout). + + DoWait ( mode, typedArray, index, value, timeout ) + + 6. Let q be ? ToNumber(timeout). + ... + Undefined Return NaN. + + 5.If q is NaN, let t be +∞, else let t be max(q, 0) + +flags: [async] +features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] +---*/ +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); + +const i32a = new Int32Array( + new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) +); + +let {async, value} = Atomics.waitAsync(i32a, 0, 0); + +value.then(result => { + + assert.sameValue(result, "ok", 'The value of `result` is "ok"'); + +}, $DONE).then($DONE, $DONE); + +Atomics.notify(i32a, 0); diff --git a/test/built-ins/Atomics/waitAsync/is-function.js b/test/built-ins/Atomics/waitAsync/is-function.js index 7888e110a3..2fc76859b3 100644 --- a/test/built-ins/Atomics/waitAsync/is-function.js +++ b/test/built-ins/Atomics/waitAsync/is-function.js @@ -7,4 +7,4 @@ description: Atomics.waitAsync is callable features: [Atomics.waitAsync, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); diff --git a/test/built-ins/Atomics/waitAsync/nan-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/nan-for-timeout-agent.js index ac3c99cb9f..072f577450 100644 --- a/test/built-ins/Atomics/waitAsync/nan-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/nan-for-timeout-agent.js @@ -18,7 +18,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -38,14 +38,14 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); - assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); + assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 1'); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i32a, 0, 0, NaN).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/negative-index-throws.js b/test/built-ins/Atomics/waitAsync/negative-index-throws.js index 64fac81f9e..0f1880c5b7 100644 --- a/test/built-ins/Atomics/waitAsync/negative-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/negative-index-throws.js @@ -17,7 +17,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -30,13 +30,13 @@ const poisoned = { assert.throws(RangeError, function() { Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, -Infinity, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, -7.999, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, -7.999, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, -7.999, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, -1, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, -300, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, -300, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, -300, poisoned, poisoned)` throws a RangeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/negative-timeout-agent.js b/test/built-ins/Atomics/waitAsync/negative-timeout-agent.js index 5a2ca5e504..c58b4fceb6 100644 --- a/test/built-ins/Atomics/waitAsync/negative-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/negative-timeout-agent.js @@ -18,7 +18,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -37,15 +37,15 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, -5).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/negative-timeout.js b/test/built-ins/Atomics/waitAsync/negative-timeout.js index 4d43525763..34456f2c79 100644 --- a/test/built-ins/Atomics/waitAsync/negative-timeout.js +++ b/test/built-ins/Atomics/waitAsync/negative-timeout.js @@ -17,7 +17,7 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, destructuring-binding, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -28,6 +28,6 @@ Promise.all([ assert.sameValue( outcome, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, -1).value resolves to "timed-out"' + 'The value of `outcome` is "timed-out"' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js index 1f990fcef1..c6a7531704 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js @@ -26,7 +26,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -52,13 +52,13 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); const lapse = await $262.agent.getReportAsync(); assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -66,7 +66,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js index cd8defbd9c..40230b2b7a 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.add(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js index b02bbfbeba..b87f1f481b 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.and(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js index 5549f45e5f..3e383639b4 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.compareExchange(i32a, 0, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js index c80108c559..32a582d2a7 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.exchange(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js index 7aa8931650..f2a62a1bd9 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.or(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js index a48b39d679..6600ce9eb6 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.store(i32a, 0, 0b1010); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js index 6a55b62453..b0b21b57d7 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.sub(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js index 1481999d4b..befc160908 100644 --- a/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js +++ b/test/built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js @@ -25,7 +25,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.small; @@ -51,7 +51,7 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); Atomics.xor(i32a, 0, 1); @@ -59,7 +59,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert( lapse >= TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse >= TIMEOUT)` is true' ); const result = await $262.agent.getReportAsync(); @@ -67,7 +67,7 @@ $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { assert.sameValue( result, 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"' + 'The value of `result` is "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js b/test/built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js index e3b781d022..bdffdd79f3 100644 --- a/test/built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js +++ b/test/built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js @@ -21,7 +21,7 @@ info: | features: [Atomics.waitAsync, Float32Array, Float64Array, Int8Array, TypedArray, Uint16Array, Uint8Array, Uint8ClampedArray, arrow-function, SharedArrayBuffer, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -33,53 +33,53 @@ assert.throws(TypeError, () => { new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Float64Array( new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Float64Array( new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT * 8) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Float32Array( new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Float32Array( new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Float32Array( new SharedArrayBuffer(Float32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Int16Array( new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Int16Array( new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Int16Array( new SharedArrayBuffer(Int16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Int8Array( new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Int8Array( new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Int8Array( new SharedArrayBuffer(Int8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Uint32Array( new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Uint32Array( new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Uint32Array( new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT * 4) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Uint16Array( new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Uint16Array( new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Uint16Array( new SharedArrayBuffer(Uint16Array.BYTES_PER_ELEMENT * 2) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Uint8Array( new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Uint8Array( new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Uint8Array( new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { const view = new Uint8ClampedArray( new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned); -}, '`const view = new Uint8ClampedArray( new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`const view = new Uint8ClampedArray( new SharedArrayBuffer(Uint8ClampedArray.BYTES_PER_ELEMENT) ); Atomics.waitAsync(view, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/non-shared-bufferdata-throws.js b/test/built-ins/Atomics/waitAsync/non-shared-bufferdata-throws.js index 530767d19f..6366dac1f3 100644 --- a/test/built-ins/Atomics/waitAsync/non-shared-bufferdata-throws.js +++ b/test/built-ins/Atomics/waitAsync/non-shared-bufferdata-throws.js @@ -20,7 +20,7 @@ info: | features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -33,8 +33,8 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync(i32a, 0, 0, 0); -}, '`Atomics.waitAsync(i32a, 0, 0, 0)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, 0, 0, 0)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(i32a, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/not-a-typedarray-throws.js b/test/built-ins/Atomics/waitAsync/not-a-typedarray-throws.js index b908d36dca..acff70adfa 100644 --- a/test/built-ins/Atomics/waitAsync/not-a-typedarray-throws.js +++ b/test/built-ins/Atomics/waitAsync/not-a-typedarray-throws.js @@ -24,7 +24,7 @@ info: | features: [Atomics.waitAsync, arrow-function, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -33,8 +33,8 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync({}, 0, 0, 0); -}, '`Atomics.waitAsync({}, 0, 0, 0)` throws TypeError'); +}, '`Atomics.waitAsync({}, 0, 0, 0)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync({}, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync({}, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/not-an-object-throws.js b/test/built-ins/Atomics/waitAsync/not-an-object-throws.js index eaf38b3f45..caf46131ba 100644 --- a/test/built-ins/Atomics/waitAsync/not-an-object-throws.js +++ b/test/built-ins/Atomics/waitAsync/not-an-object-throws.js @@ -24,7 +24,7 @@ info: | features: [Atomics.waitAsync, Symbol, arrow-function, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const poisoned = { valueOf() { throw new Test262Error('should not evaluate this code'); @@ -33,28 +33,28 @@ const poisoned = { assert.throws(TypeError, () => { Atomics.waitAsync(null, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(null, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(undefined, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(undefined, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(true, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(true, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(false, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(false, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync('***string***', poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(\'***string***\', poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync("***string***", poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(Number.NEGATIVE_INFINITY, poisoned, poisoned, poisoned)` throws a TypeError exception'); assert.throws(TypeError, () => { Atomics.waitAsync(Symbol('***symbol***'), poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(Symbol(\'***symbol***\'), poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(Symbol("***symbol***"), poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/null-bufferdata-throws.js b/test/built-ins/Atomics/waitAsync/null-bufferdata-throws.js index 4c7f440067..548357dbb8 100644 --- a/test/built-ins/Atomics/waitAsync/null-bufferdata-throws.js +++ b/test/built-ins/Atomics/waitAsync/null-bufferdata-throws.js @@ -25,7 +25,7 @@ info: | includes: [detachArrayBuffer.js] features: [Atomics.waitAsync, ArrayBuffer, Atomics, TypedArray] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -44,4 +44,4 @@ try { assert.throws(TypeError, function() { Atomics.waitAsync(i32a, poisoned, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, poisoned, poisoned, poisoned)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/null-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/null-for-timeout-agent.js index 8bf67bc4cd..2b71156ac0 100644 --- a/test/built-ins/Atomics/waitAsync/null-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/null-for-timeout-agent.js @@ -20,7 +20,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -55,40 +55,40 @@ const i32a = new Int32Array( ); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/null-for-timeout.js b/test/built-ins/Atomics/waitAsync/null-for-timeout.js index 3f5c784f2f..1d4be78001 100644 --- a/test/built-ins/Atomics/waitAsync/null-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/null-for-timeout.js @@ -17,9 +17,8 @@ info: | Null -> Return +0. features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function] -flags: [async] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) @@ -40,25 +39,15 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i32a, 0, 0, null).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, null).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, null).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"' ); - -Promise.all([ - Atomics.waitAsync(i32a, 0, 0, null).value, - Atomics.waitAsync(i32a, 0, 0, valueOf).value, - Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, - ]).then(outcomes => { - assert.sameValue(outcomes[0], "timed-out"); - assert.sameValue(outcomes[1], "timed-out"); - assert.sameValue(outcomes[2], "timed-out"); - }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/object-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/object-for-timeout-agent.js index a126b54afe..3e3b747c36 100644 --- a/test/built-ins/Atomics/waitAsync/object-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/object-for-timeout-agent.js @@ -23,7 +23,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -65,40 +65,40 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/object-for-timeout.js b/test/built-ins/Atomics/waitAsync/object-for-timeout.js index 49b459b39d..d8cc8fc359 100644 --- a/test/built-ins/Atomics/waitAsync/object-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/object-for-timeout.js @@ -22,7 +22,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics, arrow-function] flags: [async] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -48,17 +48,17 @@ const toPrimitive = { assert.sameValue( Atomics.waitAsync(i32a, 0, 0, valueOf).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, valueOf).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, toString).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toString).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, toString).value is "timed-out"' ); assert.sameValue( Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, 'timed-out', - 'Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + 'The value of Atomics.waitAsync(i32a, 0, 0, toPrimitive).value is "timed-out"' ); Promise.all([ @@ -66,7 +66,7 @@ Promise.all([ Atomics.waitAsync(i32a, 0, 0, toString).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, ]).then(outcomes => { - assert.sameValue(outcomes[0], "timed-out"); - assert.sameValue(outcomes[1], "timed-out"); - assert.sameValue(outcomes[2], "timed-out"); + assert.sameValue(outcomes[0], "timed-out", 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], "timed-out", 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], "timed-out", 'The value of outcomes[2] is "timed-out"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/out-of-range-index-throws.js b/test/built-ins/Atomics/waitAsync/out-of-range-index-throws.js index e28251dfb3..63a106e08a 100644 --- a/test/built-ins/Atomics/waitAsync/out-of-range-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/out-of-range-index-throws.js @@ -20,7 +20,7 @@ info: | 5. If accessIndex ≥ length, throw a RangeError exception. features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -33,13 +33,13 @@ const poisoned = { assert.throws(RangeError, function() { Atomics.waitAsync(i32a, Infinity, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, Infinity, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, Infinity, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, -1, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, -1, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, 4, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, 4, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, 4, poisoned, poisoned)` throws a RangeError exception'); assert.throws(RangeError, function() { Atomics.waitAsync(i32a, 200, poisoned, poisoned); -}, '`Atomics.waitAsync(i32a, 200, poisoned, poisoned)` throws RangeError'); +}, '`Atomics.waitAsync(i32a, 200, poisoned, poisoned)` throws a RangeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js b/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js index 10c96c05d1..78e8d98a7c 100644 --- a/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js @@ -21,7 +21,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -68,21 +68,21 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'poisonedValueOf', - 'Atomics.waitAsync(i32a, 0, 0, poisonedValueOf) throws' + '(await $262.agent.getReportAsync()) resolves to the value "poisonedValueOf"' ); assert.sameValue( await $262.agent.getReportAsync(), 'poisonedToPrimitive', - 'Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive) throws' + '(await $262.agent.getReportAsync()) resolves to the value "poisonedToPrimitive"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js b/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js index 9a703dc113..44b6b6bb5b 100644 --- a/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js +++ b/test/built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js @@ -19,7 +19,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) @@ -39,8 +39,8 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, 0, poisonedValueOf); -}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws a Test262Error exception'); diff --git a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js index cc8f95900a..0c6b002702 100644 --- a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js +++ b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js @@ -4,7 +4,7 @@ /*--- esid: sec-atomics.waitasync description: > - Atomics.waitAsync returns a result object containing a promise that resolves to "ok" and async is true. + Atomics.waitAsync returns a result object containing a property named "value" whose value is a promise that resolves to "ok" and async is true. info: | Atomics.waitAsync( typedArray, index, value, timeout ) @@ -25,19 +25,23 @@ info: | flags: [async] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) ); let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1000); -assert.sameValue(async, true); -assert(value instanceof Promise); -assert.sameValue(Object.getPrototypeOf(value), Promise.prototype); +assert.sameValue(async, true, 'The value of `async` is true'); +assert(value instanceof Promise, 'The result of evaluating `(value instanceof Promise)` is true'); +assert.sameValue( + Object.getPrototypeOf(value), + Promise.prototype, + 'Object.getPrototypeOf(value) must return the value of Promise.prototype' +); value.then(outcome => { - assert.sameValue(outcome, "ok"); + assert.sameValue(outcome, "ok", 'The value of `outcome` is "ok"'); }).then(() => $DONE(), $DONE); Atomics.add(i32a, 0, 1); diff --git a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js index 98ecdb1253..f6415df46c 100644 --- a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js +++ b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js @@ -23,22 +23,34 @@ info: | Return _resultObject_. flags: [async] +includes: [atomicsHelper.js] features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) ); let {async, value} = Atomics.waitAsync(i32a, 0, 0, 1); -assert.sameValue(async, true); -assert(value instanceof Promise); -assert.sameValue(Object.getPrototypeOf(value), Promise.prototype); +let outcome = null; +let lifespan = 1000; +let start = $262.agent.monotonicNow(); -value.then(outcome => { - assert.sameValue(outcome, "timed-out"); -}).then(() => $DONE(), $DONE); +function wait() { + let elapsed = $262.agent.monotonicNow() - start; + if (elapsed > lifespan) { + $DONE("Test timed out"); + return; + } + if (outcome === "timed-out") { + $DONE(); + return; + } + $262.agent.setTimeout(wait, 0); +} +wait(); +value.then(result => (outcome = result), $DONE); diff --git a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js index 667d3c876a..891ad3e35e 100644 --- a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js +++ b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js @@ -24,7 +24,7 @@ info: | features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) @@ -32,5 +32,5 @@ const i32a = new Int32Array( let {async, value} = Atomics.waitAsync(i32a, 0, 1); -assert.sameValue(async, false); -assert.sameValue(value, "not-equal"); +assert.sameValue(async, false, 'The value of `async` is false'); +assert.sameValue(value, "not-equal", 'The value of `value` is "not-equal"'); diff --git a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js index 3ab06445a5..5f50545105 100644 --- a/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js +++ b/test/built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js @@ -24,7 +24,7 @@ info: | features: [Atomics.waitAsync, TypedArray, SharedArrayBuffer, destructuring-binding, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 8) @@ -32,5 +32,5 @@ const i32a = new Int32Array( let {async, value} = Atomics.waitAsync(i32a, 0, 0, 0); -assert.sameValue(async, false); -assert.sameValue(value, "timed-out"); +assert.sameValue(async, false, 'The value of `async` is false'); +assert.sameValue(value, "timed-out", 'The value of `value` is "timed-out"'); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js b/test/built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js index 4971e4013d..2f22fdd725 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js @@ -33,7 +33,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -80,20 +80,20 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i32a, Symbol("1"), ..., ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i32a, Symbol("2"), ..., ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-index-throws.js b/test/built-ins/Atomics/waitAsync/symbol-for-index-throws.js index 2eb578aff0..a4830c0592 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-index-throws.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-index-throws.js @@ -31,7 +31,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) @@ -51,18 +51,18 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, poisonedValueOf, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, poisonedToPrimitive, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, Symbol('1'), poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf)` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, Symbol('2'), poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, Symbol("2"), poisonedToPrimitive, poisonedToPrimitive)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js b/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js index 2b2daca56e..1ee267c5f6 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js @@ -20,7 +20,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -55,21 +55,21 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i32a, 0, 0, Symbol("1")) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i32a, 0, 0, Symbol("2")) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js b/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js index 0d8bc29d37..00eb06ba8a 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js @@ -18,7 +18,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -37,16 +37,16 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, 0, poisonedValueOf); -}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, 0, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, 0, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, 0, 0, Symbol("foo")); -}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws TypeError'); +}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, 0, 0, Symbol("foo")); -}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws TypeError'); +}, '`Atomics.waitAsync(i32a, 0, 0, Symbol("foo"))` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js b/test/built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js index b6281cb516..94e3511d61 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -71,21 +71,21 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'A TypeError', - 'Atomics.waitAsync(i32a, 0, Symbol("1"), ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "A TypeError"' ); assert.sameValue( await $262.agent.getReportAsync(), 'B TypeError', - 'Atomics.waitAsync(i32a, 0, Symbol("2"), ...) throws TypeError' + '(await $262.agent.getReportAsync()) resolves to the value "B TypeError"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/symbol-for-value-throws.js b/test/built-ins/Atomics/waitAsync/symbol-for-value-throws.js index 530850ee8c..a83364dc28 100644 --- a/test/built-ins/Atomics/waitAsync/symbol-for-value-throws.js +++ b/test/built-ins/Atomics/waitAsync/symbol-for-value-throws.js @@ -22,7 +22,7 @@ info: | features: [Atomics.waitAsync, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray, computed-property-names, Atomics] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -41,16 +41,16 @@ const poisonedToPrimitive = { assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf); -}, '`Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, poisonedValueOf, poisonedValueOf)` throws a Test262Error exception'); assert.throws(Test262Error, function() { Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws Test262Error'); +}, '`Atomics.waitAsync(i32a, 0, poisonedToPrimitive, poisonedToPrimitive)` throws a Test262Error exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf); -}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedValueOf)` throws a TypeError exception'); assert.throws(TypeError, function() { Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive); -}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive)` throws TypeError'); +}, '`Atomics.waitAsync(i32a, 0, Symbol("foo"), poisonedToPrimitive)` throws a TypeError exception'); diff --git a/test/built-ins/Atomics/waitAsync/true-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/true-for-timeout-agent.js index 96b5be6368..03fea26d5b 100644 --- a/test/built-ins/Atomics/waitAsync/true-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/true-for-timeout-agent.js @@ -18,7 +18,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; @@ -50,25 +50,25 @@ const i32a = new Int32Array( ); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, false).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, valueOf).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); assert.sameValue( await $262.agent.getReportAsync(), 'timed-out', - 'await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value resolves to "timed-out"' + '(await $262.agent.getReportAsync()) resolves to the value "timed-out"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/true-for-timeout.js b/test/built-ins/Atomics/waitAsync/true-for-timeout.js index 5bcc48dcb0..bb14b9a22e 100644 --- a/test/built-ins/Atomics/waitAsync/true-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/true-for-timeout.js @@ -17,9 +17,10 @@ info: | Boolean -> If argument is true, return 1. If argument is false, return +0. flags: [async] +includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -36,12 +37,29 @@ const toPrimitive = { } }; +let outcomes = []; +let lifespan = 1000; +let start = $262.agent.monotonicNow(); + +(function wait() { + let elapsed = $262.agent.monotonicNow() - start; + if (elapsed > lifespan) { + $DONE("Test timed out"); + return; + } + if (outcomes.length) { + assert.sameValue(outcomes[0], 'timed-out', 'The value of outcomes[0] is "timed-out"'); + assert.sameValue(outcomes[1], 'timed-out', 'The value of outcomes[1] is "timed-out"'); + assert.sameValue(outcomes[2], 'timed-out', 'The value of outcomes[2] is "timed-out"'); + $DONE(); + return; + } + + $262.agent.setTimeout(wait, 0); +})(); + Promise.all([ Atomics.waitAsync(i32a, 0, 0, true).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value, Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, - ]).then(outcomes => { - assert.sameValue(outcomes[0], 'timed-out'); - assert.sameValue(outcomes[1], 'timed-out'); - assert.sameValue(outcomes[2], 'timed-out'); - }).then($DONE, $DONE); + ]).then(results => (outcomes = results), $DONE); diff --git a/test/built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js b/test/built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js index 44a13777f1..ddda9280fa 100644 --- a/test/built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js +++ b/test/built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js @@ -22,7 +22,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const WAIT_INDEX = 0; const RUNNING = 1; @@ -57,12 +57,12 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { - assert.sameValue(agentCount, NUMAGENT); + assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT'); assert.sameValue( Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT), NOTIFYCOUNT, - 'Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' + 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT' ); const reports = [ diff --git a/test/built-ins/Atomics/waitAsync/undefined-for-timeout.js b/test/built-ins/Atomics/waitAsync/undefined-for-timeout.js index bffc06d2b0..6015c551b6 100644 --- a/test/built-ins/Atomics/waitAsync/undefined-for-timeout.js +++ b/test/built-ins/Atomics/waitAsync/undefined-for-timeout.js @@ -19,25 +19,13 @@ info: | 5.If q is NaN, let t be +∞, else let t be max(q, 0) flags: [async] -includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, computed-property-names, Symbol, Symbol.toPrimitive, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); -$262.agent.start(` - $262.agent.receiveBroadcast(async (sab) => { - var i32a = new Int32Array(sab); - $262.agent.sleep(1000); - Atomics.notify(i32a, 0, 4); - $262.agent.leaving(); - }); -`); - -$262.agent.safeBroadcast(i32a); - const valueOf = { valueOf() { return undefined; @@ -54,10 +42,12 @@ Promise.all([ Atomics.waitAsync(i32a, 0, 0).value, Atomics.waitAsync(i32a, 0, 0, undefined).value, Atomics.waitAsync(i32a, 0, 0, valueOf).value, - Atomics.waitAsync(i32a, 0, 0, toPrimitive).value, + Atomics.waitAsync(i32a, 0, 0, toPrimitive).value ]).then(outcomes => { - assert.sameValue(outcomes[0], 'ok'); - assert.sameValue(outcomes[1], 'ok'); - assert.sameValue(outcomes[2], 'ok'); - assert.sameValue(outcomes[3], 'ok'); + assert.sameValue(outcomes[0], 'ok', 'The value of outcomes[0] is "ok"'); + assert.sameValue(outcomes[1], 'ok', 'The value of outcomes[1] is "ok"'); + assert.sameValue(outcomes[2], 'ok', 'The value of outcomes[2] is "ok"'); + assert.sameValue(outcomes[3], 'ok', 'The value of outcomes[3] is "ok"'); }).then($DONE, $DONE); + +Atomics.notify(i32a, 0); diff --git a/test/built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js b/test/built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js index aa4abae36e..ea219fb148 100644 --- a/test/built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js +++ b/test/built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js @@ -26,7 +26,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const WAIT_INDEX = 0; const RUNNING = 1; @@ -59,12 +59,12 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { - assert.sameValue(agentCount, NUMAGENT); + assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT'); assert.sameValue( Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT), NOTIFYCOUNT, - 'Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT` (2)' + 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 2) must return the value of NOTIFYCOUNT' ); const reports = [ diff --git a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js index a7346edf20..f39dd80f14 100644 --- a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js +++ b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js @@ -29,11 +29,11 @@ info: | features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const index = { valueOf() { - throw new Test262Error("index coerced"); + throw new Test262Error(); } }; @@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) { const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); assert.throws(TypeError, function() { Atomics.waitAsync(typedArray, index, 0, 0); - }); + }, '`Atomics.waitAsync(typedArray, index, 0, 0)` throws a TypeError exception'); } diff --git a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js index 4aca45dd8e..1174ee2d58 100644 --- a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js +++ b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js @@ -29,11 +29,11 @@ info: | features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const timeout = { valueOf() { - throw new Test262Error("timeout coerced"); + throw new Test262Error(); } }; @@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) { const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); assert.throws(TypeError, function() { Atomics.waitAsync(typedArray, 0, 0, timeout); - }); + }, '`Atomics.waitAsync(typedArray, 0, 0, timeout)` throws a TypeError exception'); } diff --git a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js index df2f490b39..e56742991d 100644 --- a/test/built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js +++ b/test/built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js @@ -29,11 +29,11 @@ info: | features: [Atomics.waitAsync, Atomics, TypedArray, SharedArrayBuffer] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const value = { valueOf() { - throw new Test262Error("value coerced"); + throw new Test262Error(); } }; @@ -46,5 +46,5 @@ for (const nonSharedArrayType of nonSharedArrayTypes) { const typedArray = new nonSharedArrayType(new SharedArrayBuffer(8)); assert.throws(TypeError, function() { Atomics.waitAsync(typedArray, 0, value, 0); - }); + }, '`Atomics.waitAsync(typedArray, 0, value, 0)` throws a TypeError exception'); } diff --git a/test/built-ins/Atomics/waitAsync/value-not-equal-agent.js b/test/built-ins/Atomics/waitAsync/value-not-equal-agent.js index 16d261f226..40c4fb5d2a 100644 --- a/test/built-ins/Atomics/waitAsync/value-not-equal-agent.js +++ b/test/built-ins/Atomics/waitAsync/value-not-equal-agent.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const value = 42; @@ -46,21 +46,21 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); assert.sameValue( await $262.agent.getReportAsync(), - value.toString(), - 'Atomics.store(i32a, 0, ${value}) returns 42' + '42', + '(await $262.agent.getReportAsync()) resolves to the value "42"' ); assert.sameValue( await $262.agent.getReportAsync(), 'not-equal', - 'Atomics.waitAsync(i32a, 0, 0).value resolves to "not-equal"' + '(await $262.agent.getReportAsync()) resolves to the value "not-equal"' ); assert.sameValue( Atomics.notify(i32a, 0, 1), 0, - 'Atomics.notify(i32a, 0, 1) returns 0 (nothing to notify)' + 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0, 1) must return 0' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/value-not-equal.js b/test/built-ins/Atomics/waitAsync/value-not-equal.js index 6210982554..c17197bb18 100644 --- a/test/built-ins/Atomics/waitAsync/value-not-equal.js +++ b/test/built-ins/Atomics/waitAsync/value-not-equal.js @@ -23,7 +23,7 @@ info: | flags: [async] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, computed-property-names, Symbol, Symbol.toPrimitive, Atomics, arrow-function] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const i32a = new Int32Array( new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4) ); @@ -44,6 +44,6 @@ Promise.all([ Atomics.store(i32a, 0, 42), Atomics.waitAsync(i32a, 0, 0).value, ]).then(outcomes => { - assert.sameValue(outcomes[0], 42); - assert.sameValue(outcomes[1], 'not-equal'); + assert.sameValue(outcomes[0], 42, 'The value of outcomes[0] is 42'); + assert.sameValue(outcomes[1], 'not-equal', 'The value of outcomes[1] is "not-equal"'); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js b/test/built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js index 09a55b2fbd..5770699199 100644 --- a/test/built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js +++ b/test/built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js @@ -24,7 +24,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const NUMAGENT = 2; const RUNNING = 4; @@ -57,28 +57,28 @@ const i32a = new Int32Array( $262.agent.safeBroadcastAsync(i32a, RUNNING, NUMAGENT).then(async (agentCount) => { - assert.sameValue(agentCount, NUMAGENT); + assert.sameValue(agentCount, NUMAGENT, 'The value of `agentCount` is expected to equal the value of NUMAGENT'); // Notify index 1, notifies nothing - assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(i32a, 1) returns 0'); + assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 1) must return 0'); // Notify index 3, notifies nothing - assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(i32a, 3) returns 0'); + assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 3) must return 0'); // Notify index 2, notifies 1 - assert.sameValue(Atomics.notify(i32a, 2), 1, 'Atomics.notify(i32a, 2) returns 1'); + assert.sameValue(Atomics.notify(i32a, 2), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 2) must return 1'); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i32a, 0, 0, Infinity).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); // Notify index 0, notifies 1 - assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); + assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)), 0) must return 1'); assert.sameValue( await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i32a, 2, 0, Infinity).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); }).then($DONE, $DONE); diff --git a/test/built-ins/Atomics/waitAsync/was-woken-before-timeout.js b/test/built-ins/Atomics/waitAsync/was-woken-before-timeout.js index a337f066e1..aacbd5ee82 100644 --- a/test/built-ins/Atomics/waitAsync/was-woken-before-timeout.js +++ b/test/built-ins/Atomics/waitAsync/was-woken-before-timeout.js @@ -9,7 +9,7 @@ flags: [async] includes: [atomicsHelper.js] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, arrow-function, async-functions] ---*/ -assert.sameValue(typeof Atomics.waitAsync, 'function'); +assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); const RUNNING = 1; const TIMEOUT = $262.agent.timeouts.huge; @@ -35,22 +35,20 @@ $262.agent.start(` $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => { - assert.sameValue(agentCount, 1); - assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); + assert.sameValue(agentCount, 1, 'The value of `agentCount` is 1'); + assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 1'); - const lapse = await $262.agent.getReportAsync(); + let lapse = await $262.agent.getReportAsync(); assert( lapse < TIMEOUT, - 'The result of `(lapse >= TIMEOUT)` is true' + 'The result of evaluating `(lapse < TIMEOUT)` is true' ); - const result = await $262.agent.getReportAsync(); - assert.sameValue( - result, + await $262.agent.getReportAsync(), 'ok', - 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "ok"' + '(await $262.agent.getReportAsync()) resolves to the value "ok"' ); - assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); + assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)), 0) must return 0'); }).then($DONE, $DONE);