S12.14_A3.js (1004B)
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: Catching system exception with "try" statement 6 es5id: 12.14_A3 7 description: Checking if execution of "catch" catches system exceptions 8 ---*/ 9 10 // CHECK#1 11 try{ 12 y; 13 throw new Test262Error('#1: "y" lead to throwing exception'); 14 } 15 catch(e){} 16 17 // CHECK#2 18 var c2=0; 19 try{ 20 try{ 21 someValue; 22 throw new Test262Error('#3.1: "someValues" lead to throwing exception'); 23 } 24 finally{ 25 c2=1; 26 } 27 } 28 catch(e){ 29 if (c2!==1){ 30 throw new Test262Error('#3.2: "finally" block must be evaluated'); 31 } 32 } 33 34 // CHECK#3 35 var c3=0,x3=0; 36 try{ 37 x3=someValue; 38 throw new Test262Error('#3.1: "x3=someValues" lead to throwing exception'); 39 } 40 catch(err){ 41 x3=1; 42 } 43 finally{ 44 c3=1; 45 } 46 if (x3!==1){ 47 throw new Test262Error('#3.2: "catch" block must be evaluated'); 48 } 49 if (c3!==1){ 50 throw new Test262Error('#3.3: "finally" block must be evaluated'); 51 } 52 53 reportCompare(0, 0);