tor-browser

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

expression-yield-as-operand.js (1052B)


      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` expressions may be used as the right-hand-side of other `yield`
     10  expressions.
     11 flags: [async]
     12 features: [async-iteration]
     13 ---*/
     14 
     15 var g = async function*() {
     16  yield yield 1;
     17 };
     18 
     19 var iter = g();
     20 iter.next().then(function(result) {
     21  assert.sameValue(result.value, 1, 'First result `value`');
     22  assert.sameValue(result.done, false, 'First result `done` flag');
     23 }).then(undefined, $DONE);
     24 
     25 iter.next().then(function(result) {
     26  assert.sameValue(result.value, undefined, 'Second result `value`');
     27  assert.sameValue(result.done, false, 'Second result `done` flag');
     28 }).then(undefined, $DONE);
     29 
     30 iter.next().then(function(result) {
     31  assert.sameValue(result.value, undefined, 'Third result `value`');
     32  assert.sameValue(result.done, true, 'Thid result `done` flag');
     33 }).then($DONE, $DONE);