summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/splice/S15.4.4.12_A6.1_T1.js
blob: 55215f44f5e2fe0f5aad90ad48705bad71368942 (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
// Copyright 2014 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: Array.prototype.splice sets `length` on `this`
esid: sec-array.prototype.splice
description: Array.prototype.splice sets `length` on Array
---*/

var a = [0, 1, 2];

a.splice(1, 2, 4);

if (a.length !== 2) {
  throw new Test262Error("Expected a.length === 2, actually " + a.length);
}

if (a[0] !== 0) {
  throw new Test262Error("Expected a[0] === 0, actually " + a[0]);
}

if (a[1] !== 4) {
  throw new Test262Error("Expected a[1] === 4, actually " + a[1]);
}

reportCompare(0, 0);