Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Atomics / wait / bigint / non-bigint64-typedarray-throws.js
blob4aada1c58269b8050af18dd5b31b15c8bada0531
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
2 // Copyright (C) 2018 Amal Hussein. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-validatesharedintegertypedarray
7 description: >
8   Throws a TypeError if typedArray arg is not a BigInt64Array
9 info: |
10   Atomics.wait( typedArray, index, value, timeout )
12   1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
13   ...
16   ValidateSharedIntegerTypedArray(typedArray [ , waitable ] )
18   ...
19   5. If waitable is true, then
20       a. If typeName is not "BigInt64Array",
21       throw a TypeError exception.
23 features: [Atomics, BigInt, SharedArrayBuffer]
24 ---*/
26 const i64a = new BigUint64Array(
27   new SharedArrayBuffer(BigUint64Array.BYTES_PER_ELEMENT)
30 const poisoned = {
31   valueOf: function() {
32     throw new Test262Error('should not evaluate this code');
33   }
36 assert.throws(TypeError, function() {
37   Atomics.wait(i64a, 0, 0n, 0);
38 });
40 assert.throws(TypeError, function() {
41   Atomics.wait(i64a, poisoned, poisoned, poisoned);
42 });
44 reportCompare(0, 0);