|
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 * FunctionDeclaration inside the "if" Expression is evaluated as true and function will not be declarated |
|
6 * |
|
7 * @path ch12/12.5/S12.5_A5.js |
|
8 * @description The "if" Expression is "function __func(){throw "FunctionExpression";}" |
|
9 */ |
|
10 |
|
11 ////////////////////////////////////////////////////////////////////////////// |
|
12 //CHECK#1 |
|
13 try { |
|
14 __func=__func; |
|
15 $ERROR('#1: "__func=__func" lead to throwing exception'); |
|
16 } catch (e) { |
|
17 ; |
|
18 } |
|
19 // |
|
20 ////////////////////////////////////////////////////////////////////////////// |
|
21 |
|
22 |
|
23 ////////////////////////////////////////////////////////////////////////////// |
|
24 //CHECK#2 |
|
25 try { |
|
26 if(function __func(){throw "FunctionExpression";}) (function(){throw "TrueBranch"})(); else (function(){"MissBranch"})(); |
|
27 } catch (e) { |
|
28 if (e !== "TrueBranch") { |
|
29 $ERROR('#2: Exception ==="TrueBranch". Actual: Exception ==='+ e); |
|
30 } |
|
31 } |
|
32 // |
|
33 ////////////////////////////////////////////////////////////////////////////// |
|
34 |
|
35 ////////////////////////////////////////////////////////////////////////////// |
|
36 //CHECK#3 |
|
37 try { |
|
38 __func=__func; |
|
39 $ERROR('#3: "__func=__func" lead to throwing exception'); |
|
40 } catch (e) { |
|
41 ; |
|
42 } |
|
43 // |
|
44 ////////////////////////////////////////////////////////////////////////////// |
|
45 |
|
46 |
|
47 |
|
48 |