summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Array/toSpliced.js
blob: 926b032f38880b336b14f4d29328e54adc622071 (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
// |reftest| 

Object.defineProperty(Array.prototype, 0, {
  set() {
    throw "bad 0";
  },
});

Object.defineProperty(Array.prototype, 1, {
  set() {
    throw "bad 1";
  },
});

assertDeepEq([].toSpliced(0, 0, 1), [1]);

assertDeepEq([0].toSpliced(0, 0, 0), [0, 0]);
assertDeepEq([0].toSpliced(0, 0, 1), [1, 0]);
assertDeepEq([0].toSpliced(0, 1, 0), [0]);
assertDeepEq([0].toSpliced(0, 1, 1), [1]);
assertDeepEq([0].toSpliced(1, 0, 0), [0, 0]);
assertDeepEq([0].toSpliced(1, 0, 1), [0, 1]);
assertDeepEq([0].toSpliced(1, 1, 0), [0, 0]);
assertDeepEq([0].toSpliced(1, 1, 1), [0, 1]);

if (typeof reportCompare === "function")
  reportCompare(0, 0);