summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/flat/null-undefined-input-throws.js
blob: aac2ff3346ebb7a1547ba46b45e6835f68bf703a (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) 2018 Shilpi Jain and Michael Ficarra. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.flat
description: >
    null or undefined should throw TypeError Exception
features: [Array.prototype.flat]
---*/

assert.sameValue(typeof Array.prototype.flat, 'function');

assert.throws(TypeError, function() {
  [].flat.call(null);
}, 'null value');

assert.throws(TypeError, function() {
  [].flat.call();
}, 'missing');

assert.throws(TypeError, function() {
  [].flat.call(void 0);
}, 'undefined');

reportCompare(0, 0);