diff options
author | Mike Pennisi <mike@mikepennisi.com> | 2016-06-11 17:27:19 -0400 |
---|---|---|
committer | Mike Pennisi <mike@mikepennisi.com> | 2016-06-11 17:27:19 -0400 |
commit | 2658524163f8594522e11a162916770eb063e8c1 (patch) | |
tree | d33195523812fc8031ca38b0418491caeadc6a40 /src/spread | |
parent | aeb88953f0303d26a47886f9d60c23d00cacea9e (diff) | |
download | qtdeclarative-testsuites-2658524163f8594522e11a162916770eb063e8c1.tar.gz |
Add test templates for spread in array initializer
Formulate templates for the SpreadElement in an array initializer in
order to conform to existing pattern.
Diffstat (limited to 'src/spread')
-rw-r--r-- | src/spread/default/array.template | 31 | ||||
-rw-r--r-- | src/spread/error/array.template | 26 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/spread/default/array.template b/src/spread/default/array.template new file mode 100644 index 000000000..f5525ce4e --- /dev/null +++ b/src/spread/default/array.template @@ -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); diff --git a/src/spread/error/array.template b/src/spread/error/array.template new file mode 100644 index 000000000..3506aeaa0 --- /dev/null +++ b/src/spread/error/array.template @@ -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 }*/]; +}); |