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