js/src/tests/test262/ch12/12.14/S12.14_A9_T4.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:2b6e5e4174ac
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 * "try" with "catch" or "finally" statement within/without an "do while" statement
6 *
7 * @path ch12/12.14/S12.14_A9_T4.js
8 * @description "try" statement within a loop, the statement contains "continue" and "break" statements
9 */
10
11 // CHECK#1
12 var c1=0,fin=0;
13 do{
14 try{
15 c1+=1;
16 break;
17 }
18 catch(er1){}
19 finally{
20 fin=1;
21 continue;
22 }
23 fin=-1;
24 c1+=2;
25 }
26 while(c1<2);
27 if(fin!==1){
28 $ERROR('#1.1: "finally" block must be evaluated');
29 }
30 if(c1!==2){
31 $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly');
32 }
33
34 // CHECK#2
35 var c2=0,fin2=0;
36 do{
37 try{
38 throw "ex1";
39 }
40 catch(er1){
41 c2+=1;
42 break;
43 }
44 finally{
45 fin2=1;
46 continue;
47 }
48 c2+=2;
49 fin2=-1;
50 }
51 while(c2<2);
52 if(fin2!==1){
53 $ERROR('#2.1: "finally" block must be evaluated');
54 }
55 if(c2!==2){
56 $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly');
57 }
58

mercurial