Debian Codegraph @

rhino/testsrc/tests/js1_2/statements/continue.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 = 'continue.js';
7
8 /**
9 Filename: continue.js
10 Description: 'Tests the continue statement'
11
12 Author: Nick Lerissa
13 Date: March 18, 1998
14 */
15
16 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
17 var VERSION = 'no version';
18 startTest();
19 var TITLE = 'statements: continue';
20
21 writeHeaderToLog("Executing script: continue.js");
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 var i,j;
25
26 j = 0;
27 for (i = 0; i < 200; i++)
28 {
29 if (i == 100)
30 continue;
31 j++;
32 }
33
34 // '"continue" in a "for" loop'
35 new TestCase ( SECTION, '"continue" in "for" loop',
36 199, j);
37
38
39 j = 0;
40 out1:
41 for (i = 0; i < 1000; i++)
42 {
43 if (i == 100)
44 {
45 out2:
46 for (var k = 0; k < 1000; k++)
47 {
48 if (k == 500) continue out1;
49 }
50 j = 3000;
51 }
52 j++;
53 }
54
55 // '"continue" in a "for" loop with a "label"'
56 new TestCase ( SECTION, '"continue" in "for" loop with a "label"',
57 999, j);
58
59 i = 0;
60 j = 1;
61
62 while (i != j)
63 {
64 i++;
65 if (i == 100) continue;
66 j++;
67 }
68
69 // '"continue" in a "while" loop'
70 new TestCase ( SECTION, '"continue" in a "while" loop',
71 100, j );
72
73 j = 0;
74 i = 0;
75 out3:
76 while (i < 1000)
77 {
78 if (i == 100)
79 {
80 var k = 0;
81 out4:
82 while (k < 1000)
83 {
84 if (k == 500)
85 {
86 i++;
87 continue out3;
88 }
89 k++;
90 }
91 j = 3000;
92 }
93 j++;
94 i++;
95 }
96
97 // '"continue" in a "while" loop with a "label"'
98 new TestCase ( SECTION, '"continue" in a "while" loop with a "label"',
99 999, j);
100
101 i = 0;
102 j = 1;
103
104 do
105 {
106 i++;
107 if (i == 100) continue;
108 j++;
109 } while (i != j);
110
111
112 // '"continue" in a "do" loop'
113 new TestCase ( SECTION, '"continue" in a "do" loop',
114 100, j );
115
116 j = 0;
117 i = 0;
118 out5:
119 do
120 {
121 if (i == 100)
122 {
123 var k = 0;
124 out6:
125 do
126 {
127 if (k == 500)
128 {
129 i++;
130 continue out5;
131 }
132 k++;
133 }while (k < 1000);
134 j = 3000;
135 }
136 j++;
137 i++;
138 }while (i < 1000);
139
140 // '"continue" in a "do" loop with a "label"'
141 new TestCase ( SECTION, '"continue" in a "do" loop with a "label"',
142 999, j);
143
144 test();