js/src/tests/ecma/ExecutionContexts/10.2.3-2.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/ExecutionContexts/10.2.3-2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          10.2.3-2.js
    1.12 +   ECMA Section:       10.2.3 Function and Anonymous Code
    1.13 +   Description:
    1.14 +
    1.15 +   The scope chain is initialized to contain the activation object followed
    1.16 +   by the global object. Variable instantiation is performed using the
    1.17 +   activation by the global object. Variable instantiation is performed using
    1.18 +   the activation object as the variable object and using property attributes
    1.19 +   { DontDelete }. The caller provides the this value. If the this value
    1.20 +   provided by the caller is not an object (including the case where it is
    1.21 +   null), then the this value is the global object.
    1.22 +
    1.23 +   Author:             christine@netscape.com
    1.24 +   Date:               12 november 1997
    1.25 +*/
    1.26 +
    1.27 +var SECTION = "10.2.3-2";
    1.28 +var VERSION = "ECMA_1";
    1.29 +startTest();
    1.30 +var TITLE   = "Function and Anonymous Code";
    1.31 +
    1.32 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.33 +
    1.34 +var o = new MyObject("hello");
    1.35 +
    1.36 +new TestCase( SECTION,
    1.37 +	      "MyFunction(\"PASSED!\")",
    1.38 +	      "PASSED!",
    1.39 +	      MyFunction("PASSED!") );
    1.40 +
    1.41 +var o = MyFunction();
    1.42 +
    1.43 +new TestCase( SECTION,
    1.44 +	      "MyOtherFunction(true);",
    1.45 +	      false,
    1.46 +	      MyOtherFunction(true) );
    1.47 +
    1.48 +test();
    1.49 +
    1.50 +function MyFunction( value ) {
    1.51 +  var x = value;
    1.52 +  delete x;
    1.53 +  return x;
    1.54 +}
    1.55 +function MyOtherFunction(value) {
    1.56 +  var x = value;
    1.57 +  return delete x;
    1.58 +}
    1.59 +function MyObject( value ) {
    1.60 +  this.THIS = this;
    1.61 +}

mercurial