S12.14_A10_T5.js (913B)
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 Using "try" with "catch" or "finally" statement within/without a "while" 7 statement 8 es5id: 12.14_A10_T5 9 description: Throw some exceptions from different place of loop body 10 ---*/ 11 12 // CHECK#1 13 var c=0, i=0; 14 var fin=0; 15 while(i<10){ 16 i+=1; 17 try{ 18 if(c===0){ 19 throw "ex1"; 20 throw new Test262Error('#1.1: throw "ex1" lead to throwing exception'); 21 } 22 c+=2; 23 if(c===1){ 24 throw "ex2"; 25 throw new Test262Error('#1.2: throw "ex2" lead to throwing exception'); 26 } 27 } 28 catch(er1){ 29 c-=1; 30 continue; 31 throw new Test262Error('#1.3: "try catch{continue} finally" must work correctly'); 32 } 33 finally{ 34 fin+=1; 35 } 36 } 37 if(fin!==10){ 38 throw new Test262Error('#1.4: "finally" block must be evaluated'); 39 } 40 41 reportCompare(0, 0);