Debian Codegraph @

js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T2.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 If (Evaluate Statement).type is "break" and (Evaluate Statement).target
7 is in the current label set, (normal, (Evaluate Statement), empty) is
8 returned while evaluating a "var-loop"
9 es5id: 12.6.3_A12.1_T2
10 description: Embedded loops
11 ---*/
12
13 var __str;
14 __str="";
15
16 outer : for(var index=0; index<4; index+=1) {
17 nested : for(var index_n=0; index_n<=index; index_n++) {
18 if (index*index_n >= 4)break nested;
19 __str+=""+index+index_n;
20 }
21 }
22
23 //////////////////////////////////////////////////////////////////////////////
24 //CHECK#1
25 if (__str !== "00101120213031") {
26 throw new Test262Error('#1: __str === "00101120213031". Actual: __str ==='+ __str );
27 }
28 //
29 //////////////////////////////////////////////////////////////////////////////
30
31 __str="";
32
33 outer : for(var index=0; index<4; index+=1) {
34 nested : for(var index_n=0; index_n<=index; index_n++) {
35 if (index*index_n >= 4)break outer;
36 __str+=""+index+index_n;
37 }
38 }
39
40 //////////////////////////////////////////////////////////////////////////////
41 //CHECK#2
42 if (__str !== "0010112021") {
43 throw new Test262Error('#2: __str === "0010112021". Actual: __str ==='+ __str );
44 }
45 //
46 //////////////////////////////////////////////////////////////////////////////
47
48 __str="";
49
50 outer : for(var index=0; index<4; index+=1) {
51 nested : for(var index_n=0; index_n<=index; index_n++) {
52 if (index*index_n >= 4)break ;
53 __str+=""+index+index_n;
54 }
55 }
56
57 //////////////////////////////////////////////////////////////////////////////
58 //CHECK#3
59 if (__str !== "00101120213031") {
60 throw new Test262Error('#3: __str === "00101120213031". Actual: __str ==='+ __str );
61 }
62 //
63 //////////////////////////////////////////////////////////////////////////////
64
65 reportCompare(0, 0);