aboutsummaryrefslogtreecommitdiffstats
path: root/src/dstr-assignment-for-await/obj-rest-to-property-with-setter.case
blob: d5db125a097e71c53f93e50b7ca707916948cfec (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
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2017 Caio Lima & the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
desc: >
    When DestructuringAssignmentTarget is an object property setter, its value should be
    binded as rest object.
template: default
esid: pending
features: [object-rest]
---*/

//- setup
let settedValue;
let executedGetter = false;
let src = {
  get y() {
    executedGetter = true;
  },
  set y(v) {
    settedValue = v;
  },
};
src.y = undefined;
//- elems
{...src.y}
//- vals
{ x: 1, y: 2}
//- body
assert.sameValue(settedValue.x, 1);
assert.sameValue(settedValue.y, 2);
assert(!executedGetter, "The property should not be accessed");

//- teardown
promise
  .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
  .then($DONE, $DONE);