S12.14_A7_T1.js (3730B)
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: Evaluating the nested productions TryStatement 6 es5id: 12.14_A7_T1 7 description: > 8 Checking if the production of nested TryStatement statements 9 evaluates correct 10 ---*/ 11 12 // CHECK#1 13 try{ 14 try{ 15 throw "ex2"; 16 } 17 catch(er2){ 18 if (er2!=="ex2") 19 throw new Test262Error('#1.1: Exception === "ex2". Actual: Exception ==='+ e ); 20 throw "ex1"; 21 } 22 } 23 catch(er1){ 24 if (er1!=="ex1") throw new Test262Error('#1.2: Exception === "ex1". Actual: '+er1); 25 if (er1==="ex2") throw new Test262Error('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); 26 } 27 28 // CHECK#2 29 try{ 30 throw "ex1"; 31 } 32 catch(er1){ 33 try{ 34 throw "ex2"; 35 } 36 catch(er1){ 37 if (er1==="ex1") throw new Test262Error('#2.1: Exception !== "ex1". Actual: catch previous catching exception'); 38 if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 ); 39 } 40 if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 ); 41 if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous catching exception'); 42 } 43 44 // CHECK#3 45 try{ 46 throw "ex1"; 47 } 48 catch(er1){ 49 if (er1!=="ex1") throw new Test262Error('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); 50 } 51 finally{ 52 try{ 53 throw "ex2"; 54 } 55 catch(er1){ 56 if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous embedded exception'); 57 if (er1!=="ex2") throw new Test262Error('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 ); 58 } 59 } 60 61 // CHECK#4 62 var c4=0; 63 try{ 64 throw "ex1"; 65 } 66 catch(er1){ 67 try{ 68 throw "ex2"; 69 } 70 catch(er1){ 71 if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex1". Actual: catch previous catching exception'); 72 if (er1!=="ex2") throw new Test262Error('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 ); 73 } 74 if (er1!=="ex1") throw new Test262Error('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); 75 if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception'); 76 } 77 finally{ 78 c4=1; 79 } 80 if (c4!==1) throw new Test262Error('#4.5: "finally" block must be evaluated'); 81 82 // CHECK#5 83 var c5=0; 84 try{ 85 try{ 86 throw "ex2"; 87 } 88 catch(er1){ 89 if (er1!=="ex2") throw new Test262Error('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); 90 } 91 throw "ex1"; 92 } 93 catch(er1){ 94 if (er1!=="ex1") throw new Test262Error('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 ); 95 if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous embedded exception'); 96 } 97 finally{ 98 c5=1; 99 } 100 if (c5!==1) throw new Test262Error('#5.4: "finally" block must be evaluated'); 101 102 // CHECK#6 103 var c6=0; 104 try{ 105 try{ 106 throw "ex1"; 107 } 108 catch(er1){ 109 if (er1!=="ex1") throw new Test262Error('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); 110 } 111 } 112 finally{ 113 c6=1; 114 } 115 if (c6!==1) throw new Test262Error('#6.2: "finally" block must be evaluated'); 116 117 // CHECK#7 118 var c7=0; 119 try{ 120 try{ 121 throw "ex1"; 122 } 123 finally{ 124 try{ 125 c7=1; 126 throw "ex2"; 127 } 128 catch(er1){ 129 if (er1!=="ex2") throw new Test262Error('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); 130 if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex1". Actual: catch previous embedded exception'); 131 c7++; 132 } 133 } 134 } 135 catch(er1){ 136 if (er1!=="ex1") throw new Test262Error('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); 137 } 138 if (c7!==2) throw new Test262Error('#7.4: "finally" block must be evaluated'); 139 140 reportCompare(0, 0);