]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/NativeObjects/15-1.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
24 ECMA Section: 15 Native ECMAScript Objects
25 Description: Every built-in prototype object has the Object prototype
26 object, which is the value of the expression
27 Object.prototype (15.2.3.1) as the value of its internal
28 [[Prototype]] property, except the Object prototype
31 Every native object associated with a program-created
32 function also has the Object prototype object as the
33 value of its internal [[Prototype]] property.
35 Author: christine@netscape.com
40 var VERSION
= "ECMA_1";
42 var TITLE
= "Native ECMAScript Objects";
44 writeHeaderToLog( SECTION
+ " "+ TITLE
);
46 var testcases
= getTestCases();
49 function getTestCases() {
50 var array
= new Array();
53 array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
54 array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
55 array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
56 array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
57 array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
58 // array[item++] = new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ );
59 array[item++] = new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ );
60 array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ );
62 array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ );
64 array
[item
++] = new TestCase( SECTION
, "Function.prototype.__proto__ == Object.prototype", true, Function
.prototype.__proto__
== Object
.prototype );
65 array
[item
++] = new TestCase( SECTION
, "Array.prototype.__proto__ == Object.prototype", true, Array
.prototype.__proto__
== Object
.prototype );
66 array
[item
++] = new TestCase( SECTION
, "String.prototype.__proto__ == Object.prototype", true, String
.prototype.__proto__
== Object
.prototype );
67 array
[item
++] = new TestCase( SECTION
, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean
.prototype.__proto__
== Object
.prototype );
68 array
[item
++] = new TestCase( SECTION
, "Number.prototype.__proto__ == Object.prototype", true, Number
.prototype.__proto__
== Object
.prototype );
69 // array[item++] = new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype );
70 array
[item
++] = new TestCase( SECTION
, "Date.prototype.__proto__ == Object.prototype", true, Date
.prototype.__proto__
== Object
.prototype );
71 array
[item
++] = new TestCase( SECTION
, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase
.prototype.__proto__
== Object
.prototype );
73 array
[item
++] = new TestCase( SECTION
, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject
.prototype.__proto__
== Object
.prototype );
79 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
81 testcases
[tc
].passed
= writeTestCaseResult(
84 testcases
[tc
].description
+" = "+ testcases
[tc
].actual
);
85 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";
92 function MyObject( value
) {
94 this.valueOf
= new Function( "return this.value" );