Skip to content
Snippets Groups Projects
Commit 26585241 authored by Mike Pennisi's avatar Mike Pennisi
Browse files

Add test templates for spread in array initializer

Formulate templates for the SpreadElement in an array initializer in
order to conform to existing pattern.
parent aeb88953
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/array/spread-
name: Array initializer
esid: sec-runtime-semantics-arrayaccumulation
es6id: 12.2.5.2
info: |
SpreadElement : ...AssignmentExpression
1. Let spreadRef be the result of evaluating AssignmentExpression.
2. Let spreadObj be ? GetValue(spreadRef).
3. Let iterator be ? GetIterator(spreadObj).
4. Repeat
a. Let next be ? IteratorStep(iterator).
b. If next is false, return nextIndex.
c. Let nextValue be ? IteratorValue(next).
d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
nextValue).
e. Assert: status is true.
f. Let nextIndex be nextIndex + 1.
---*/
var callCount = 0;
(function(/*{ params }*/) {
/*{ body }*/
callCount += 1;
}.apply(null, [/*{ args }*/]));
assert.sameValue(callCount, 1);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/array/spread-err-
name: Array initializer
esid: sec-runtime-semantics-arrayaccumulation
es6id: 12.2.5.2
info: |
SpreadElement : ...AssignmentExpression
1. Let spreadRef be the result of evaluating AssignmentExpression.
2. Let spreadObj be ? GetValue(spreadRef).
3. Let iterator be ? GetIterator(spreadObj).
4. Repeat
a. Let next be ? IteratorStep(iterator).
b. If next is false, return nextIndex.
c. Let nextValue be ? IteratorValue(next).
d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
nextValue).
e. Assert: status is true.
f. Let nextIndex be nextIndex + 1.
---*/
assert.throws(/*{ error }*/, function() {
[/*{ args }*/];
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment