|
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 * Catching objects with try/catch/finally statement |
|
6 * |
|
7 * @path ch12/12.14/S12.14_A18_T3.js |
|
8 * @description Catching boolean |
|
9 */ |
|
10 |
|
11 // CHECK#1 |
|
12 try{ |
|
13 throw true; |
|
14 } |
|
15 catch(e){ |
|
16 if (e!==true) $ERROR('#1: Exception ===true. Actual: Exception ==='+ e ); |
|
17 } |
|
18 |
|
19 // CHECK#2 |
|
20 try{ |
|
21 throw false; |
|
22 } |
|
23 catch(e){ |
|
24 if (e!==false) $ERROR('#2: Exception ===false. Actual: Exception ==='+ e ); |
|
25 } |
|
26 |
|
27 // CHECK#3 |
|
28 var b=false; |
|
29 try{ |
|
30 throw b; |
|
31 } |
|
32 catch(e){ |
|
33 if (e!==false) $ERROR('#3: Exception ===false. Actual: Exception ==='+ e ); |
|
34 } |
|
35 |
|
36 // CHECK#4 |
|
37 var b=true; |
|
38 try{ |
|
39 throw b; |
|
40 } |
|
41 catch(e){ |
|
42 if (e!==true) $ERROR('#4: Exception ===true. Actual: Exception ==='+ e ); |
|
43 } |
|
44 |
|
45 // CHECK#5 |
|
46 var b=true; |
|
47 try{ |
|
48 throw b&&false; |
|
49 } |
|
50 catch(e){ |
|
51 if (e!==false) $ERROR('#5: Exception ===false. Actual: Exception ==='+ e ); |
|
52 } |
|
53 |
|
54 // CHECK#5 |
|
55 var b=true; |
|
56 try{ |
|
57 throw b||false; |
|
58 } |
|
59 catch(e){ |
|
60 if (e!==true) $ERROR('#6: Exception ===true. Actual: Exception ==='+ e ); |
|
61 } |
|
62 |