tor-browser

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

expression-yield-as-statement.js (1519B)


      1 // |reftest| async
      2 // Copyright 2017 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 author: Caitlin Potter <caitp@igalia.com>
      7 esid: sec-generator-function-definitions
      8 description: >
      9  `yield` is a valid statement within async generator function bodies.
     10 flags: [async]
     11 features: [async-iteration]
     12 ---*/
     13 
     14 var g1 = async function*() { yield; };
     15 var g2 = async function*() { yield 1; };
     16 
     17 var iter1 = g1();
     18 iter1.next().then(function(result) {
     19  assert.sameValue(
     20    result.value, undefined, "Without right-hand-side: first result `value`");
     21  assert.sameValue(
     22    result.done, false, "Without right-hand-side: first result `done` flag");
     23 }).then(undefined, $DONE);
     24 iter1.next().then(function(result) {
     25  assert.sameValue(
     26    result.value, undefined, "Without right-hand-side: second result `value`");
     27  assert.sameValue(
     28    result.done, true, "Without right-hand-side: second result `done` flag");
     29 }).then(undefined, $DONE);
     30 
     31 var iter2 = g2();
     32 iter2.next().then(function(result) {
     33  assert.sameValue(
     34    result.value, 1, "With right-hand-side: first result `value`");
     35  assert.sameValue(
     36    result.done, false, "With right-hand-side: first result `done` flag");
     37 }).then(undefined, $DONE);
     38 iter2.next().then(function(result) {
     39  assert.sameValue(
     40    result.value, undefined, "With right-hand-side: second result `value`");
     41  assert.sameValue(
     42    result.done, true, "With right-hand-side: second result `done` flag");
     43 }).then($DONE, $DONE);