1 /** 2 * File Name: label-001.js 3 * ECMA Section: 4 * Description: Labeled statements 5 * 6 * Labeled break and continue within a for loop. 7 * 8 * 9 * Author: christine (at) netscape.com 10 * Date: 11 August 1998 11 */ 12 var SECTION = "label-003"; 13 var VERSION = "ECMA_2"; 14 var TITLE = "Labeled statements"; 15 16 startTest(); 17 writeHeaderToLog( SECTION + " "+ TITLE); 18 19 var tc = 0; 20 var testcases = new Array(); 21 22 LabelTest(0, 0); 23 LabelTest(1, 1) 24 LabelTest(-1, 1000); 25 LabelTest(false, 0); 26 LabelTest(true, 1); 27 28 test(); 29 30 function LabelTest( limit, expect) { 31 woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } }; 32 33 testcases[tc++] = new TestCase( 34 SECTION, 35 "break out of a labeled for loop: "+ limit, 36 expect, 37 result ); 38 } 39 40