js/src/tests/ecma/ExecutionContexts/10.1.3-1.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.1.3-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     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.1.3-1.js
    1.12 +   ECMA Section:       10.1.3
    1.13 +   Description:
    1.14 +
    1.15 +   For each formal parameter, as defined in the FormalParameterList, create
    1.16 +   a property of the variable object whose name is the Identifier and whose
    1.17 +   attributes are determined by the type of code. The values of the
    1.18 +   parameters are supplied by the caller. If the caller supplies fewer
    1.19 +   parameter values than there are formal parameters, the extra formal
    1.20 +   parameters have value undefined. If two or more formal parameters share
    1.21 +   the same name, hence the same property, the corresponding property is
    1.22 +   given the value that was supplied for the last parameter with this name.
    1.23 +   If the value of this last parameter was not supplied by the caller,
    1.24 +   the value of the corresponding property is undefined.
    1.25 +
    1.26 +
    1.27 +   http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191
    1.28 +
    1.29 +   Author:             christine@netscape.com
    1.30 +   Date:               12 november 1997
    1.31 +*/
    1.32 +
    1.33 +var SECTION = "10.1.3-1";
    1.34 +var VERSION = "ECMA_1";
    1.35 +var TITLE   = "Variable Instantiation:  Formal Parameters";
    1.36 +var BUGNUMBER="104191";
    1.37 +startTest();
    1.38 +
    1.39 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.40 +
    1.41 +var myfun1 = new Function( "a", "a", "return a" );
    1.42 +var myfun2 = new Function( "a", "b", "a", "return a" );
    1.43 +
    1.44 +function myfun3(a, b, a) {
    1.45 +  return a;
    1.46 +}
    1.47 +
    1.48 +// myfun1, myfun2, myfun3 tostring
    1.49 +
    1.50 +
    1.51 +new TestCase(
    1.52 +  SECTION,
    1.53 +  String(myfun2) +"; myfun2(2,4,8)",
    1.54 +  8,
    1.55 +  myfun2(2,4,8) );
    1.56 +
    1.57 +new TestCase(
    1.58 +  SECTION,
    1.59 +  "myfun2(2,4)",
    1.60 +  void 0,
    1.61 +  myfun2(2,4));
    1.62 +
    1.63 +new TestCase(
    1.64 +  SECTION,
    1.65 +  String(myfun3) +"; myfun3(2,4,8)",
    1.66 +  8,
    1.67 +  myfun3(2,4,8) );
    1.68 +
    1.69 +new TestCase(
    1.70 +  SECTION,
    1.71 +  "myfun3(2,4)",
    1.72 +  void 0,
    1.73 +  myfun3(2,4) );
    1.74 +
    1.75 +test();
    1.76 +

mercurial