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