summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/splice/S15.4.4.12_A6.1_T2.js
blob: a865a7bc78d1464c1c946008b2e8b8767a86fb34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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 = [0, 1, 2];

Object.defineProperty(a, 'length', {
  writable: false
});

assert.throws(TypeError, function() {
  a.splice(1, 2, 4);
});

reportCompare(0, 0);