Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/waitAsync/bigint/negative-timeout.js

raw
1 // |reftest| shell-option(--setpref=atomics_wait_async) skip-if(!this.hasOwnProperty('SharedArrayBuffer')||!this.hasOwnProperty('Atomics')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))||!xulRuntime.shell) async -- SharedArrayBuffer,Atomics is not enabled unconditionally, ARM64 Simulator cannot emulate atomics, requires shell-options
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-atomics.waitasync
6 description: >
7 Test that Atomics.waitAsync times out with a negative timeout
8 info: |
9 Atomics.waitAsync( typedArray, index, value, timeout )
10
11 1. Return DoWait(async, typedArray, index, value, timeout).
12
13 DoWait ( mode, typedArray, index, value, timeout )
14
15 6. Let q be ? ToNumber(timeout).
16
17 flags: [async]
18 features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, BigInt, destructuring-binding, arrow-function]
19 ---*/
20 assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"');
21 const i64a = new BigInt64Array(new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4));
22
23 Promise.all([Atomics.waitAsync(i64a, 0, 0n, -1).value]).then(([outcome]) => {
24 assert.sameValue(outcome, 'timed-out', 'The value of `outcome` is "timed-out"');
25 }).then($DONE, $DONE);