js/src/tests/test262/ch13/13.0/S13_A6_T2.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:47eebf7f4291
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 can be overrided by other FunctionDeclaration with the same Identifier
6 *
7 * @path ch13/13.0/S13_A6_T2.js
8 * @description Calling a function before it is declared one more time
9 */
10
11 //////////////////////////////////////////////////////////////////////////////
12 //CHECK#1
13 try{
14 var __result = __func();
15 } catch(e) {
16 $FAIL("#1: Function call can appears in the program before the FunctionDeclaration appears");
17 }
18 if (__result !== "SECOND") {
19 $ERROR('#1.1: __result === "SECOND". Actual: __result ==='+__result);
20 }
21 //
22 //////////////////////////////////////////////////////////////////////////////
23
24 function __func(){return "FIRST";};
25
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#2
28 __result = __func();
29 if (__result !== "SECOND") {
30 $ERROR('#2: __result === "SECOND". Actual: __result ==='+__result);
31 }
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35 function __func(){return "SECOND";};
36

mercurial