]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/ObjectObjects/15.2.2.2.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.2.2.2.js
24 ECMA Section: 15.2.2.2 new Object()
27 When the Object constructor is called with no argument, the following
30 1. Create a new native ECMAScript object.
31 The [[Prototype]] property of the newly constructed object is set to
32 the Object prototype object.
34 The [[Class]] property of the newly constructed object is set
37 The newly constructed object has no [[Value]] property.
39 Return the newly created native object.
41 Author: christine@netscape.com
44 var SECTION
= "15.2.2.2";
45 var VERSION
= "ECMA_1";
47 var TITLE
= "new Object()";
49 writeHeaderToLog( SECTION
+ " "+ TITLE
);
51 var testcases
= getTestCases();
54 function getTestCases() {
55 var array
= new Array();
58 array
[item
++] = new TestCase( SECTION
, "typeof new Object()", "object", typeof new Object() );
59 array
[item
++] = new TestCase( SECTION
, "Object.prototype.toString()", "[object Object]", Object
.prototype.toString() );
60 array
[item
++] = new TestCase( SECTION
, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
65 for ( tc
= 0; tc
< testcases
.length
; tc
++ ) {
66 testcases
[tc
].passed
= writeTestCaseResult(
69 testcases
[tc
].description
+" = "+ testcases
[tc
].actual
);
71 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";
77 function MyObject( value
) {
79 this.valueOf
= new Function( "return this.value" );
80 this.toString
= new Function( "return this.value+''" );