S13_A6_T2.js (1196B)
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 FunctionDeclaration can be overrided by other FunctionDeclaration with 7 the same Identifier 8 es5id: 13_A6_T2 9 description: Calling a function before it is declared one more time 10 ---*/ 11 12 ////////////////////////////////////////////////////////////////////////////// 13 //CHECK#1 14 try{ 15 var __result = __func(); 16 } catch(e) { 17 throw new Test262Error("#1: Function call can appears in the program before the FunctionDeclaration appears"); 18 } 19 if (__result !== "SECOND") { 20 throw new Test262Error('#1.1: __result === "SECOND". Actual: __result ==='+__result); 21 } 22 // 23 ////////////////////////////////////////////////////////////////////////////// 24 25 function __func(){return "FIRST";}; 26 27 ////////////////////////////////////////////////////////////////////////////// 28 //CHECK#2 29 __result = __func(); 30 if (__result !== "SECOND") { 31 throw new Test262Error('#2: __result === "SECOND". Actual: __result ==='+__result); 32 } 33 // 34 ////////////////////////////////////////////////////////////////////////////// 35 36 function __func(){return "SECOND";}; 37 38 reportCompare(0, 0);