iterator-toString.js (788B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var summary = "gen.toString() omitting 'yield' from value"; 8 var actual, expect; 9 10 printStatus(summary); 11 12 /************** 13 * BEGIN TEST * 14 **************/ 15 16 var failed = false; 17 18 function* gen() 19 { 20 yield 17; 21 } 22 23 try 24 { 25 var str = gen.toString(); 26 var index = str.search(/yield/); 27 28 if (index < 0) 29 throw "yield not found in str: " + str; 30 } 31 catch (e) 32 { 33 failed = e; 34 } 35 36 37 38 expect = false; 39 actual = failed; 40 41 reportCompare(expect, actual, summary);