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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * Function call cannot appear in the program before the FunctionExpression appears
     6  *
     7  * @path ch13/13.0/S13_A17_T2.js
     8  * @description Trying to call a function before the FunctionExpression appears and then using the FunctionExpression one more time
     9  */
    11 //////////////////////////////////////////////////////////////////////////////
    12 //CHECK#1
    13 try{
    14     var __result = __func();
    15 	$ERROR("#1: var __result = __func() lead to throwing exception");
    16 } catch(e) {
    17   if ((e instanceof TypeError) !== true) {
    18     $ERROR('#1.2: func should throw a TypeError  Actual: ' + (e));  
    19   }
    20 }
    21 //
    22 //////////////////////////////////////////////////////////////////////////////
    24 // now we reach the __func overwriting by new expression
    25 var __func = function __func(){return "ONE";};
    27 //////////////////////////////////////////////////////////////////////////////
    28 //CHECK#2
    29 var __result = __func();
    30 if (__result !== "ONE") {
    31 	$ERROR('#2: __result === "ONE". Actual: __result ==='+__result);
    32 }
    33 //
    34 //////////////////////////////////////////////////////////////////////////////
    36 __func = function __func(){return "TWO";};
    38 //////////////////////////////////////////////////////////////////////////////
    39 //CHECK#3
    40 var __result = __func();
    41 if (__result !== "TWO") {
    42 	$ERROR('#3: __result === "TWO". Actual: __result ==='+__result);
    43 }
    44 //
    45 //////////////////////////////////////////////////////////////////////////////

mercurial