tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S13_A17_T1.js (1490B)


      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    Function call cannot appear in the program before the FunctionExpression
      7    appears
      8 es5id: 13_A17_T1
      9 description: Trying to call a function before the FunctionExpression appears
     10 ---*/
     11 
     12 //////////////////////////////////////////////////////////////////////////////
     13 //CHECK#1
     14 try{
     15    var __result = __func();
     16 throw new Test262Error("#1.1: var __result = __func() lead to throwing exception");
     17 } catch(e) {
     18  if ((e instanceof TypeError) !== true) {
     19    throw new Test262Error('#1.2: func should throw a TypeError  Actual: ' + (e));  
     20  }
     21 }
     22 //
     23 //////////////////////////////////////////////////////////////////////////////
     24 
     25 var __func = function (){return "ONE";};
     26 
     27 //////////////////////////////////////////////////////////////////////////////
     28 //CHECK#2
     29 var __result = __func();
     30 if (__result !== "ONE") {
     31 throw new Test262Error('#2: __result === "ONE". Actual: __result ==='+__result);
     32 }
     33 //
     34 //////////////////////////////////////////////////////////////////////////////
     35 
     36 __func = function (){return "TWO";};
     37 
     38 //////////////////////////////////////////////////////////////////////////////
     39 //CHECK#3
     40 var __result = __func();
     41 if (__result !== "TWO") {
     42 throw new Test262Error('#3: __result === "TWO". Actual: __result ==='+__result);
     43 }
     44 //
     45 //////////////////////////////////////////////////////////////////////////////
     46 
     47 reportCompare(0, 0);