Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.1_A8_T1.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: |
6 When the [[Call]] property for a Function object F is called, the following steps are taken:
7 2. Evaluate F's FunctionBody;
8 if Result.type is thrown then Result.value is thrown too
9 es5id: 13.2.1_A8_T1
10 description: >
11 Throwing an exception within a function body. Declaring function
12 with "function __func()"
13 ---*/
14
15 function __func(){
16 var x = 1;
17 throw ("Catch Me If You Can")
18 return x;
19 }
20
21 try{
22 var x=__func()
23 throw new Test262Error('#0: var x=__func() lead to throwing exception');
24 } catch(e){
25 if (e !== "Catch Me If You Can") {
26 throw new Test262Error('#1: Exception === "Catch Me If You Can". Actual: exception ==='+e);
27 }
28 }
29
30 reportCompare(0, 0);