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