|
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 * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression |
|
6 * |
|
7 * @path ch12/12.13/S12.13_A2_T5.js |
|
8 * @description Throwing number |
|
9 */ |
|
10 |
|
11 // CHECK#1 |
|
12 try{ |
|
13 throw 13; |
|
14 } |
|
15 catch(e){ |
|
16 if (e!==13) $ERROR('#1: Exception ===13. Actual: Exception ==='+ e ); |
|
17 } |
|
18 |
|
19 // CHECK#2 |
|
20 var b=13; |
|
21 try{ |
|
22 throw b; |
|
23 } |
|
24 catch(e){ |
|
25 if (e!==13) $ERROR('#2: Exception ===13. Actual: Exception ==='+ e ); |
|
26 } |
|
27 |
|
28 // CHECK#3 |
|
29 try{ |
|
30 throw 2.13; |
|
31 } |
|
32 catch(e){ |
|
33 if (e!==2.13) $ERROR('#3: Exception ===2.13. Actual: Exception ==='+ e ); |
|
34 } |
|
35 |
|
36 // CHECK#4 |
|
37 try{ |
|
38 throw NaN; |
|
39 } |
|
40 catch(e){ |
|
41 if (!isNaN(e)) $ERROR('#4: Exception is NaN'); |
|
42 } |
|
43 |
|
44 // CHECK#5 |
|
45 try{ |
|
46 throw +Infinity; |
|
47 } |
|
48 catch(e){ |
|
49 if (e!==+Infinity) $ERROR('#5: Exception ===+Infinity. Actual: Exception ==='+ e ); |
|
50 } |
|
51 |
|
52 // CHECK#6 |
|
53 try{ |
|
54 throw -Infinity; |
|
55 } |
|
56 catch(e){ |
|
57 if (e!==-Infinity) $ERROR('#6: Exception ===-Infinity. Actual: Exception ==='+ e ); |
|
58 } |
|
59 |
|
60 // CHECK#7 |
|
61 try{ |
|
62 throw +0; |
|
63 } |
|
64 catch(e){ |
|
65 if (e!==+0) $ERROR('#7: Exception ===+0. Actual: Exception ==='+ e ); |
|
66 } |
|
67 |
|
68 // CHECK#8 |
|
69 try{ |
|
70 throw -0; |
|
71 } |
|
72 catch(e){ |
|
73 if (e!==-0) $ERROR('#8: Exception ===-0. Actual: Exception ==='+ e ); |
|
74 } |
|
75 |