tor-browser

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

star-string.js (1034B)


      1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 25.2
      5 description: >
      6    When a string is the operand of a `yield *` expression, the generator
      7    should produce an iterator that visits each character in order.
      8 features: [generators]
      9 ---*/
     10 
     11 function* g() {
     12  yield* 'abc';
     13 }
     14 var iter = g();
     15 var result;
     16 
     17 result = iter.next();
     18 assert.sameValue(result.value, 'a', 'First result `value`');
     19 assert.sameValue(result.done, false, 'First result `done` flag');
     20 
     21 result = iter.next();
     22 assert.sameValue(result.value, 'b', 'Second result `value`');
     23 assert.sameValue(result.done, false, 'Second result `done` flag');
     24 
     25 result = iter.next();
     26 assert.sameValue(result.value, 'c', 'Third result `value`');
     27 assert.sameValue(result.done, false, 'Third result `done` flag');
     28 
     29 result = iter.next();
     30 assert.sameValue(result.value, undefined, 'Final result `value`');
     31 assert.sameValue(result.done, true, 'Final result `done` flag');
     32 
     33 reportCompare(0, 0);