summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/toSpliced/this-value-nullish.js
blob: 1230d05f0099e1762a2aae690b484930fff10540 (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
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.toSpliced
description: >
  Array.prototype.toSpliced throws if the receiver is null or undefined
info: |
  Array.prototype.toSpliced ( start, deleteCount, ...items )

  1. Let O be ? ToObject(this value).
  ...
features: [change-array-by-copy]
---*/

assert.throws(TypeError, () => {
  Array.prototype.toSpliced.call(null, 0, 0);
}, '`Array.prototype.toSpliced.call(null)` throws TypeError');

assert.throws(TypeError, () => {
  Array.prototype.toSpliced.call(undefined, 0, 0);
}, '`Array.prototype.toSpliced.call(undefined)` throws TypeError');

reportCompare(0, 0);