Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier |
michael@0 | 6 | * |
michael@0 | 7 | * @path ch13/13.0/S13_A6_T2.js |
michael@0 | 8 | * @description Calling a function before it is declared one more time |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 12 | //CHECK#1 |
michael@0 | 13 | try{ |
michael@0 | 14 | var __result = __func(); |
michael@0 | 15 | } catch(e) { |
michael@0 | 16 | $FAIL("#1: Function call can appears in the program before the FunctionDeclaration appears"); |
michael@0 | 17 | } |
michael@0 | 18 | if (__result !== "SECOND") { |
michael@0 | 19 | $ERROR('#1.1: __result === "SECOND". Actual: __result ==='+__result); |
michael@0 | 20 | } |
michael@0 | 21 | // |
michael@0 | 22 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 23 | |
michael@0 | 24 | function __func(){return "FIRST";}; |
michael@0 | 25 | |
michael@0 | 26 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 27 | //CHECK#2 |
michael@0 | 28 | __result = __func(); |
michael@0 | 29 | if (__result !== "SECOND") { |
michael@0 | 30 | $ERROR('#2: __result === "SECOND". Actual: __result ==='+__result); |
michael@0 | 31 | } |
michael@0 | 32 | // |
michael@0 | 33 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 34 | |
michael@0 | 35 | function __func(){return "SECOND";}; |
michael@0 | 36 |