Debian Codegraph @

js/src/tests/test262/language/statements/try/S12.14_A1.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: |
6 The production TryStatement : try Block Catch is evaluated as follows: 2.
7 If Result(1).type is not throw, return Result(1)
8 es5id: 12.14_A1
9 description: >
10 Executing TryStatement : try Block Catch. The statements doesn't
11 cause actual exceptions
12 ---*/
13
14 // CHECK#1
15 try {
16 var x=0;
17 }
18 catch (e) {
19 throw new Test262Error('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
20 }
21
22 // CHECK#2
23 var c1=0;
24 try{
25 var x1=1;
26 }
27 finally
28 {
29 c1=1;
30 }
31 if(x1!==1){
32 throw new Test262Error('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated');
33 }
34 if (c1!==1){
35 throw new Test262Error('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
36 }
37
38 // CHECK#3
39 var c2=0;
40 try{
41 var x2=1;
42 }
43 catch(e){
44 throw new Test262Error('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
45 }
46 finally{
47 c2=1;
48 }
49 if(x2!==1){
50 throw new Test262Error('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated');
51 }
52 if (c2!==1){
53 throw new Test262Error('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
54 }
55
56 reportCompare(0, 0);