summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/flat/empty-array-elements.js
blob: a8472974c31bdbf8ae9e12291f4d0c1e3850b7fa (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 (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: >
    arrays with empty arrays elements
includes: [compareArray.js]
features: [Array.prototype.flat]
---*/

var a = {};
assert.compareArray([].flat(), [], '[].flat() must return []');
assert.compareArray([
  [],
  []
].flat(), [], '[ [], [] ].flat() must return []');
assert.compareArray([
  [],
  [1]
].flat(), [1], '[ [], [1] ].flat() must return [1]');
assert.compareArray([
  [],
  [1, a]
].flat(), [1, a], '[ [], [1, a] ].flat() must return [1, a]');

reportCompare(0, 0);