Debian Codegraph @

js/src/tests/test262/language/statements/try/S12.14_A8.js

raw
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: "\"try\" with \"catch\" or \"finally\" statement within/without an \"if\" statement"
6 es5id: 12.14_A8
7 description: Throwing exception within an "if" statement
8 ---*/
9
10 // CHECK#1
11 var c1=1;
12 try{
13 if(c1===1){
14 throw "ex1";
15 throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
16 }
17 throw new Test262Error('#1.2: throw "ex1" inside the "if" statement lead to throwing exception');
18 }
19 catch(er1){
20 if (er1!=="ex1") throw new Test262Error('#1.3: Exception ==="ex1". Actual: Exception ==='+er1);
21 }
22
23 // CHECK#2
24 var c2=1;
25 if(c2===1){
26 try{
27 throw "ex1";
28 throw new Test262Error('#2.1: throw "ex1" lead to throwing exception');
29 }
30 catch(er1){
31 if(er1!="ex1") throw new Test262Error('#2.2: Exception ==="ex1". Actual: Exception ==='+er1);
32 }
33 }
34
35 reportCompare(0, 0);