Debian Codegraph @

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