Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * "try" with "catch" or "finally" statement within/without an "do while" statement |
michael@0 | 6 | * |
michael@0 | 7 | * @path ch12/12.14/S12.14_A9_T4.js |
michael@0 | 8 | * @description "try" statement within a loop, the statement contains "continue" and "break" statements |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | // CHECK#1 |
michael@0 | 12 | var c1=0,fin=0; |
michael@0 | 13 | do{ |
michael@0 | 14 | try{ |
michael@0 | 15 | c1+=1; |
michael@0 | 16 | break; |
michael@0 | 17 | } |
michael@0 | 18 | catch(er1){} |
michael@0 | 19 | finally{ |
michael@0 | 20 | fin=1; |
michael@0 | 21 | continue; |
michael@0 | 22 | } |
michael@0 | 23 | fin=-1; |
michael@0 | 24 | c1+=2; |
michael@0 | 25 | } |
michael@0 | 26 | while(c1<2); |
michael@0 | 27 | if(fin!==1){ |
michael@0 | 28 | $ERROR('#1.1: "finally" block must be evaluated'); |
michael@0 | 29 | } |
michael@0 | 30 | if(c1!==2){ |
michael@0 | 31 | $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly'); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | // CHECK#2 |
michael@0 | 35 | var c2=0,fin2=0; |
michael@0 | 36 | do{ |
michael@0 | 37 | try{ |
michael@0 | 38 | throw "ex1"; |
michael@0 | 39 | } |
michael@0 | 40 | catch(er1){ |
michael@0 | 41 | c2+=1; |
michael@0 | 42 | break; |
michael@0 | 43 | } |
michael@0 | 44 | finally{ |
michael@0 | 45 | fin2=1; |
michael@0 | 46 | continue; |
michael@0 | 47 | } |
michael@0 | 48 | c2+=2; |
michael@0 | 49 | fin2=-1; |
michael@0 | 50 | } |
michael@0 | 51 | while(c2<2); |
michael@0 | 52 | if(fin2!==1){ |
michael@0 | 53 | $ERROR('#2.1: "finally" block must be evaluated'); |
michael@0 | 54 | } |
michael@0 | 55 | if(c2!==2){ |
michael@0 | 56 | $ERROR('#2.2: "try catch{break} finally{continue}" must work correctly'); |
michael@0 | 57 | } |
michael@0 | 58 |