summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/splice/S15.4.4.12_A6.1_T3.js
blob: 9a6823e058e0c7cf104d2da60332949a5fce035f (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 throws if `length` is read-only
---*/

var a = {
  get length() {
    return 0;
  },
  splice: Array.prototype.splice
};

try {
  a.splice(1, 2, 4);
  throw new Test262Error("Expected a TypeError");
} catch (e) {
  if (!(e instanceof TypeError)) {
    throw e;
  }
}

reportCompare(0, 0);