blob: c240f7084e6b53da1d995c4d783d7777b54ed1e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// |reftest| shell-option(--enable-change-array-by-copy) skip-if(!Int32Array.prototype.with)
class Err {}
const indices = [
-Infinity, -10, -0.5, -0, 0, 0.5, 10, Infinity, NaN
];
let value = {
valueOf() {
throw new Err;
}
};
let ta = new Int32Array(5);
for (let index of indices) {
assertThrowsInstanceOf(() => ta.with(index, value), Err);
}
for (let index of indices) {
let ta = new Int32Array(5);
let value = {
valueOf() {
detachArrayBuffer(ta.buffer);
return 0;
}
};
assertThrowsInstanceOf(() => ta.with(index, value), RangeError);
}
if (typeof reportCompare === "function")
reportCompare(0, 0);
|