js/src/tests/ecma/Expressions/11.2.2-4-n.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:          11.2.2-4-n.js
     9    ECMA Section:       11.2.2. The new operator
    10    Description:
    12    MemberExpression:
    13    PrimaryExpression
    14    MemberExpression[Expression]
    15    MemberExpression.Identifier
    16    new MemberExpression Arguments
    18    new NewExpression
    20    The production NewExpression : new NewExpression is evaluated as follows:
    22    1.   Evaluate NewExpression.
    23    2.   Call GetValue(Result(1)).
    24    3.   If Type(Result(2)) is not Object, generate a runtime error.
    25    4.   If Result(2) does not implement the internal [[Construct]] method,
    26    generate a runtime error.
    27    5.   Call the [[Construct]] method on Result(2), providing no arguments
    28    (that is, an empty list of arguments).
    29    6.   If Type(Result(5)) is not Object, generate a runtime error.
    30    7.   Return Result(5).
    32    The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
    34    1.   Evaluate MemberExpression.
    35    2.   Call GetValue(Result(1)).
    36    3.   Evaluate Arguments, producing an internal list of argument values
    37    (section 0).
    38    4.   If Type(Result(2)) is not Object, generate a runtime error.
    39    5.   If Result(2) does not implement the internal [[Construct]] method,
    40    generate a runtime error.
    41    6.   Call the [[Construct]] method on Result(2), providing the list
    42    Result(3) as the argument values.
    43    7.   If Type(Result(6)) is not Object, generate a runtime error.
    44    8    .Return Result(6).
    46    Author:             christine@netscape.com
    47    Date:               12 november 1997
    48 */
    50 var SECTION = "11.2.2-4-n.js";
    51 var VERSION = "ECMA_1";
    52 startTest();
    53 var TITLE   = "The new operator";
    55 writeHeaderToLog( SECTION + " "+ TITLE);
    57 var STRING = "";
    59 DESCRIPTION = "STRING = '', var s = new STRING()";
    60 EXPECTED = "error";
    62 new TestCase( SECTION,
    63 	      "STRING = '', var s = new STRING()",
    64 	      "error",
    65 	      eval("s = new STRING()") );
    66 test();
    68 function TestFunction() {
    69   return arguments;
    70 }

mercurial