Debian Codegraph @

rhino/testsrc/tests/ecma_2/Statements/dowhile-005.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 = 'dowhile-005.js';
7
8 /**
9 * File Name: dowhile-005
10 * ECMA Section:
11 * Description: do...while statements
12 *
13 * Test a labeled do...while. Break out of the loop with no label
14 * should break out of the loop, but not out of the label.
15 *
16 * Currently causes an infinite loop in the monkey. Uncomment the
17 * print statement below and it works OK.
18 *
19 * Author: [email protected]
20 * Date: 26 August 1998
21 */
22 var SECTION = "dowhile-005";
23 var VERSION = "ECMA_2";
24 var TITLE = "do...while with a labeled continue statement";
25 var BUGNUMBER = "316293";
26
27 startTest();
28 writeHeaderToLog( SECTION + " "+ TITLE);
29
30 NestedLabel();
31
32
33 test();
34
35 function NestedLabel() {
36 i = 0;
37 result1 = "pass";
38 result2 = "fail: did not hit code after inner loop";
39 result3 = "pass";
40
41 outer: {
42 do {
43 inner: {
44 // print( i );
45 break inner;
46 result1 = "fail: did break out of inner label";
47 }
48 result2 = "pass";
49 break outer;
50 print(i);
51 } while ( i++ < 100 );
52
53 }
54
55 result3 = "fail: did not break out of outer label";
56
57 new TestCase(
58 SECTION,
59 "number of loop iterations",
60 0,
61 i );
62
63 new TestCase(
64 SECTION,
65 "break out of inner loop",
66 "pass",
67 result1 );
68
69 new TestCase(
70 SECTION,
71 "break out of outer loop",
72 "pass",
73 result2 );
74 }