summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Array/unshift-with-enumeration.js
blob: fbf451b8cc3fa59926f6a82260271e68816becde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function f(array, method, args) {
  var called = false;
  var keys = [];
  for (var key in array) {
    keys.push(key);
    if (!called) {
      called = true;
      Reflect.apply(method, array, args);
    }
  }
  return keys;
}

assertEqArray(f([1, /* hole */, 3], Array.prototype.unshift, [0]), ["0"]);
assertEqArray(f([1, /* hole */, 3], Array.prototype.splice, [0, 0, 0]), ["0"]);

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