~ubuntu-branches/ubuntu/wily/mozjs17/wily

« back to all changes in this revision

Viewing changes to js/src/tests/ecma/Expressions/11.2.2-1-n.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/. */
 
5
 
 
6
 
 
7
/**
 
8
   File Name:          11.2.2-1.js
 
9
   ECMA Section:       11.2.2. The new operator
 
10
   Description:
 
11
 
 
12
   MemberExpression:
 
13
   PrimaryExpression
 
14
   MemberExpression[Expression]
 
15
   MemberExpression.Identifier
 
16
   new MemberExpression Arguments
 
17
 
 
18
   new NewExpression
 
19
 
 
20
   The production NewExpression : new NewExpression is evaluated as follows:
 
21
 
 
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).
 
31
 
 
32
   The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
 
33
 
 
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).
 
45
 
 
46
   Author:             christine@netscape.com
 
47
   Date:               12 november 1997
 
48
*/
 
49
 
 
50
var SECTION = "11.2.2-1-n.js";
 
51
var VERSION = "ECMA_1";
 
52
startTest();
 
53
var TITLE   = "The new operator";
 
54
 
 
55
writeHeaderToLog( SECTION + " "+ TITLE);
 
56
 
 
57
var OBJECT = new Object();
 
58
 
 
59
DESCRIPTION = "OBJECT = new Object; var o = new OBJECT()";
 
60
EXPECTED = "error";
 
61
 
 
62
new TestCase( SECTION,
 
63
              "OBJECT = new Object; var o = new OBJECT()",
 
64
              "error",
 
65
              eval("o = new OBJECT()") );
 
66
test();
 
67
 
 
68
function TestFunction() {
 
69
  return arguments;
 
70
}