|
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 * 1. Evaluate Expression |
|
6 * |
|
7 * @path ch12/12.13/S12.13_A3_T6.js |
|
8 * @description Evaluating functions |
|
9 */ |
|
10 |
|
11 // CHECK#1 |
|
12 var i=0; |
|
13 function adding1(){ |
|
14 i++; |
|
15 return 1; |
|
16 } |
|
17 try{ |
|
18 throw (adding1()); |
|
19 } |
|
20 catch(e){ |
|
21 if (e!==1) $ERROR('#1: Exception ===1. Actual: Exception ==='+ e); |
|
22 } |
|
23 |
|
24 // CHECK#2 |
|
25 var i=0; |
|
26 function adding2(){ |
|
27 i++; |
|
28 return i; |
|
29 } |
|
30 try{ |
|
31 throw adding2(); |
|
32 } |
|
33 catch(e){} |
|
34 if (i!==1) $ERROR('#2: i===1. Actual: i==='+ i); |
|
35 |
|
36 // CHECK#3 |
|
37 var i=0; |
|
38 function adding3(){ |
|
39 i++; |
|
40 } |
|
41 try{ |
|
42 throw adding3(); |
|
43 } |
|
44 catch(e){} |
|
45 if (i!==1) $ERROR('#3: i===1. Actual: i==='+i); |
|
46 |
|
47 // CHECK#4 |
|
48 function adding4(i){ |
|
49 i++; |
|
50 return i; |
|
51 } |
|
52 try{ |
|
53 throw (adding4(1)); |
|
54 } |
|
55 catch(e){ |
|
56 if (e!==2) $ERROR('#4: Exception ===2. Actual: Exception ==='+ e); |
|
57 } |
|
58 |