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