summaryrefslogtreecommitdiff
path: root/src/dstr-assignment/obj-rest-order.case
blob: 2448b1a18e3bee23bc73f42dc197f38363e633eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2017 Caio Lima. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Rest operation follows [[OwnPropertyKeys]] order
template: default
esid: pending
includes: [compareArray.js]
features: [Symbol, object-rest]
---*/

//- setup
var rest;
var calls = [];
var o = { get z() { calls.push('z') }, get a() { calls.push('a') } };
Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true });
Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true });
//- elems
{...rest}
//- vals
o
//- body
assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]));
assert.sameValue(Object.keys(rest).length, 3);