summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js')
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..20ab4e6e64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Lone rest element (direct binding) (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+async function* f([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);