Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * Using "try" with "catch" or "finally" statement within/without a "for" statement
6 *
7 * @path ch12/12.14/S12.14_A11_T4.js
8 * @description Try statement inside loop, where combinate using break and continue
9 */
11 // CHECK#1
12 var c1=0,fin=0;
13 for(var i=0;i<5;i++){
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 if(fin!==1){
27 $ERROR('#1.1: "finally" block must be evaluated');
28 }
29 if(c1!==5){
30 $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly');
31 }
33 // CHECK#2
34 var c2=0,fin2=0;
35 for(var i=0;i<5;i++){
36 try{
37 throw "ex1";
38 }
39 catch(er1){
40 c2+=1;
41 break;
42 }
43 finally{
44 fin2=1;
45 continue;
46 }
47 c2+=2;
48 fin2=-1;
49 }
50 if(fin2!==1){
51 $ERROR('#2.1: "finally" block must be evaluated');
52 }
53 if(c2!==5){
54 $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly');
55 }