js/src/tests/test262/ch12/12.14/S12.14_A7_T3.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

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_T3.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 catch(er2){
michael@0 17 if (er2!=="ex2") $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+er2);
michael@0 18 throw "ex1";
michael@0 19 }
michael@0 20 finally{
michael@0 21 throw "ex3";
michael@0 22 }
michael@0 23 }
michael@0 24 catch(er1){
michael@0 25 if (er1!=="ex3") $ERROR('#1.2: Exception === "ex3". Actual: Exception ==='+er1);
michael@0 26 if (er1==="ex2") $ERROR('#1.3: Exception !=="ex2". Actual: catch previous catched exception');
michael@0 27 if (er1==="ex1") $ERROR('#1.4: Exception !=="ex1". Actual: catch previous embedded exception');
michael@0 28 }
michael@0 29
michael@0 30 // CHECK#2
michael@0 31 var c2=0;
michael@0 32 try{
michael@0 33 throw "ex1";
michael@0 34 }
michael@0 35 catch(er1){
michael@0 36 try{
michael@0 37 throw "ex2";
michael@0 38 }
michael@0 39 catch(er1){
michael@0 40 if (er1==="ex1") $ERROR('#2.1: Exception !=="ex1". Actual: catch previous catched exception');
michael@0 41 if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 42 }
michael@0 43 finally{
michael@0 44 c2=1;
michael@0 45 }
michael@0 46 if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+er1);
michael@0 47 if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous embedded exception');
michael@0 48 }
michael@0 49 if (c2!==1) $ERROR('#2.5: "finally" block must be evaluated');
michael@0 50
michael@0 51 // CHECK#3
michael@0 52 var c3=0;
michael@0 53 try{
michael@0 54 throw "ex1";
michael@0 55 }
michael@0 56 catch(er1){
michael@0 57 if (er1!=="ex1") $ERROR('#3.1: Exception === "ex1". Actual: Exception ==='+er1);
michael@0 58 }
michael@0 59 finally{
michael@0 60 try{
michael@0 61 throw "ex2";
michael@0 62 }
michael@0 63 catch(er1){
michael@0 64 if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous catched exception');
michael@0 65 if (er1!=="ex2") $ERROR('#3.3: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 66 }
michael@0 67 finally{
michael@0 68 c3=1;
michael@0 69 }
michael@0 70 }
michael@0 71 if (c3!==1) $ERROR('#3.4: "finally" block must be evaluated');
michael@0 72
michael@0 73 // CHECK#4
michael@0 74 var c4=0;
michael@0 75 try{
michael@0 76 try{
michael@0 77 throw "ex1";
michael@0 78 }
michael@0 79 catch(er1){
michael@0 80 try{
michael@0 81 throw "ex2";
michael@0 82 }
michael@0 83 catch(er1){
michael@0 84 if (er1==="ex1") $ERROR('#4.1: Exception !=="ex2". Actual: catch previous catched exception');
michael@0 85 if (er1!=="ex2") $ERROR('#4.2: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 86 }
michael@0 87 finally{
michael@0 88 c4=2;
michael@0 89 throw "ex3";
michael@0 90 }
michael@0 91 if (er1!=="ex1") $ERROR('#4.3: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 92 if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: catch previous catched exception');
michael@0 93 if (er1==="ex3") $ERROR('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception');
michael@0 94 }
michael@0 95 finally{
michael@0 96 c4*=2;
michael@0 97 }
michael@0 98 }
michael@0 99 catch(er1){}
michael@0 100 if (c4!==4) $ERROR('#4.6: "finally" block must be evaluated');
michael@0 101
michael@0 102 // CHECK#5
michael@0 103 var c5=0;
michael@0 104 try{
michael@0 105 try{
michael@0 106 throw "ex2";
michael@0 107 }
michael@0 108 catch(er1){
michael@0 109 if (er1!=="ex2") $ERROR('#5.1: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 110 }
michael@0 111 finally{
michael@0 112 throw "ex3";
michael@0 113 }
michael@0 114 throw "ex1";
michael@0 115 }
michael@0 116 catch(er1){
michael@0 117 if (er1!=="ex3") $ERROR('#5.2: Exception === "ex3". Actual: Exception ==='+er1);
michael@0 118 if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous catched exception');
michael@0 119 if (er1==="ex1") $ERROR('#5.4: Exception !=="ex1". Actual: catch previous embedded exception');
michael@0 120 }
michael@0 121 finally{
michael@0 122 c5=1;
michael@0 123 }
michael@0 124 if (c5!==1) $ERROR('#5.5: "finally" block must be evaluated');
michael@0 125
michael@0 126 // CHECK#6
michael@0 127 var c6=0;
michael@0 128 try{
michael@0 129 try{
michael@0 130 throw "ex1";
michael@0 131 }
michael@0 132 catch(er1){
michael@0 133 if (er1!=="ex1") $ERROR('#6.1: Exception === "ex1". Actual: Exception ==='+er1);
michael@0 134 }
michael@0 135 finally{
michael@0 136 c6=2;
michael@0 137 }
michael@0 138 }
michael@0 139 finally{
michael@0 140 c6*=2;
michael@0 141 }
michael@0 142 if (c6!==4) $ERROR('#6.2: "finally" block must be evaluated');
michael@0 143
michael@0 144 // CHECK#7
michael@0 145 var c7=0;
michael@0 146 try{
michael@0 147 try{
michael@0 148 throw "ex1";
michael@0 149 }
michael@0 150 finally{
michael@0 151 try{
michael@0 152 c7=1;
michael@0 153 throw "ex2";
michael@0 154 }
michael@0 155 catch(er1){
michael@0 156 if (er1!=="ex2") $ERROR('#7.1: Exception === "ex2". Actual: Exception ==='+er1);
michael@0 157 if (er1==="ex1") $ERROR('#7.2: Exception !=="ex2". Actual: catch previous catched exception');
michael@0 158 c7++;
michael@0 159 }
michael@0 160 finally{
michael@0 161 c7*=2;
michael@0 162 }
michael@0 163 }
michael@0 164 }
michael@0 165 catch(er1){
michael@0 166 if (er1!=="ex1") $ERROR('#7.3: Exception === "ex1". Actual: Exception ==='+er1);
michael@0 167 }
michael@0 168 if (c7!==4) $ERROR('#7.4: "finally" block must be evaluated');
michael@0 169

mercurial