aboutsummaryrefslogtreecommitdiffstats
path: root/src/generators/yield-spread-arr-single.case
blob: e3f6b8d5f1521760a5ef2e11961c4ff6ffc084c9 (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
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
desc: Use yield value in a array spread position
template: default
info: |
  Array Initializer

  SpreadElement[Yield, Await]:
    ...AssignmentExpression[+In, ?Yield, ?Await]
---*/

//- setup
var arr = ['a', 'b', 'c'];
//- body
  yield [...yield];
//- assertions
iter.next(false);
var item = iter.next(arr);
var value = item.value;

assert.notSameValue(value, arr, 'value is a new array');
assert(Array.isArray(value), 'value is an Array exotic object');
assert.sameValue(value.length, 3)
assert.sameValue(value[0], 'a');
assert.sameValue(value[1], 'b');
assert.sameValue(value[2], 'c');
assert.sameValue(item.done, false);