Debian Codegraph @

rhino/testsrc/tests/ecma_2/Statements/label-001.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 gTestfile = 'label-001.js';
7
8 /**
9 * File Name: label-001.js
10 * ECMA Section:
11 * Description: Labeled statements
12 *
13 * Labeled break and continue within a for loop.
14 *
15 *
16 * Author: [email protected]
17 * Date: 11 August 1998
18 */
19 var SECTION = "label-003";
20 var VERSION = "ECMA_2";
21 var TITLE = "Labeled statements";
22
23 startTest();
24 writeHeaderToLog( SECTION + " "+ TITLE);
25
26 LabelTest(0, 0);
27 LabelTest(1, 1)
28 LabelTest(-1, 1000);
29 LabelTest(false, 0);
30 LabelTest(true, 1);
31
32 test();
33
34 function LabelTest( limit, expect) {
35 woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } };
36
37 new TestCase(
38 SECTION,
39 "break out of a labeled for loop: "+ limit,
40 expect,
41 result );
42 }
43