summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/toReversed/this-value-nullish.js
blob: 682b28addf26d5b219fcacee47aa7e19a34a37d3 (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.toReversed
description: >
  Array.prototype.toReversed throws if the receiver is null or undefined
info: |
  Array.prototype.toReversed ( )

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

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

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

reportCompare(0, 0);