Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/pause/non-integral-iterationnumber-throws.js

raw
1 // |reftest| shell-option(--enable-atomics-pause) skip-if(!this.hasOwnProperty('Atomics')||!Atomics.pause||!xulRuntime.shell) -- Atomics.pause is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-atomics.pause
7 description: Atomics.pause throws on non-integral Number argument values
8 features: [Atomics.pause]
9 ---*/
10
11 const values = [
12 true,
13 false,
14 null,
15 42.42,
16 -42.42,
17 NaN,
18 Infinity,
19 Symbol("foo"),
20 "bar",
21 "42",
22 /baz/,
23 42n,
24 {},
25 [],
26 function() {},
27 { valueOf() { return 42; } }
28 ];
29
30 for (const v of values) {
31 assert.throws(TypeError, () => { Atomics.pause(v); },
32 `${v ? v.toString() : v} is an illegal iterationNumber`);
33 }
34
35 reportCompare(0, 0);