js/src/tests/ecma/Statements/12.2-1.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          12.2-1.js
     9    ECMA Section:       The variable statement
    10    Description:
    12    If the variable statement occurs inside a FunctionDeclaration, the
    13    variables are defined with function-local scope in that function, as
    14    described in section 10.1.3. Otherwise, they are defined with global
    15    scope, that is, they are created as members of the global object, as
    16    described in section 0. Variables are created when the execution scope
    17    is entered. A Block does not define a new execution scope. Only Program and
    18    FunctionDeclaration produce a new scope. Variables are initialized to the
    19    undefined value when created. A variable with an Initializer is assigned
    20    the value of its AssignmentExpression when the VariableStatement is executed,
    21    not when the variable is created.
    23    Author:             christine@netscape.com
    24    Date:               12 november 1997
    25 */
    27 var SECTION = "12.2-1";
    28 var VERSION = "ECMA_1";
    29 startTest();
    30 var TITLE   = "The variable statement";
    32 writeHeaderToLog( SECTION +" "+ TITLE);
    34 new TestCase(    "SECTION",
    35 		 "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
    36 		 void 0,
    37 		 eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
    39 test();

mercurial