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

var a = {},
  b = {};

assert.compareArray([a].flat(), [a], '[a].flat() must return [a]');
assert.compareArray([a, [b]].flat(), [a, b], '[a, [b]].flat() must return [a, b]');
assert.compareArray([
  [a], b
].flat(), [a, b], '[ [a], b ].flat() must return [a, b]');
assert.compareArray([
  [a],
  [b]
].flat(), [a, b], '[ [a], [b] ].flat() must return [a, b]');

reportCompare(0, 0);