mirror of
https://github.com/tc39/test262.git
synced 2025-07-28 08:24:23 +02:00
Add test templates for spread in array initializer
Formulate templates for the SpreadElement in an array initializer in order to conform to existing pattern.
This commit is contained in:
parent
aeb88953f0
commit
2658524163
31
src/spread/default/array.template
Normal file
31
src/spread/default/array.template
Normal file
@ -0,0 +1,31 @@
|
||||
// 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);
|
26
src/spread/error/array.template
Normal file
26
src/spread/error/array.template
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 }*/];
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user