tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ary-ptrn-rest-id-direct.js (1278B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/dstr-binding/ary-ptrn-rest-id-direct.case
      4 // - src/dstr-binding/default/async-gen-func-expr.template
      5 /*---
      6 description: Lone rest element (direct binding) (async generator function expression)
      7 esid: sec-asyncgenerator-definitions-evaluation
      8 features: [async-iteration]
      9 flags: [generated, async]
     10 includes: [compareArray.js]
     11 info: |
     12    AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
     13        AsyncGeneratorBody }
     14 
     15        [...]
     16        3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
     17           AsyncGeneratorBody, scope, strict).
     18        [...]
     19 
     20 
     21    Runtime Semantics: IteratorBindingInitialization
     22 
     23    BindingRestElement : ... BindingIdentifier
     24 
     25    [...]
     26    2. Let A be ! ArrayCreate(0).
     27    3. Let n be 0.
     28    4. Repeat,
     29        [...]
     30        f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
     31        g. Set n to n + 1.
     32 
     33 ---*/
     34 
     35 
     36 var callCount = 0;
     37 var f;
     38 f = async function*([...x]) {
     39  assert(Array.isArray(x));
     40  assert.compareArray(x, [1]);
     41  callCount = callCount + 1;
     42 };
     43 
     44 f([1]).next().then(() => {
     45    assert.sameValue(callCount, 1, 'invoked exactly once');
     46 }).then($DONE, $DONE);