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/ 5 * 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. 10 * 11 * The Original Code is Mozilla Communicator client code, released March 12 * 31, 1998. 13 * 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 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 */ 22/** 23 File Name: 15.js 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 29 object itself. 30 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. 34 35 Author: christine@netscape.com 36 Date: 28 october 1997 37 38*/ 39 var SECTION = "15-1"; 40 var VERSION = "ECMA_1"; 41 startTest(); 42 var TITLE = "Native ECMAScript Objects"; 43 44 writeHeaderToLog( SECTION + " "+ TITLE); 45 46 var testcases = getTestCases(); 47 test(); 48 49function getTestCases() { 50 var array = new Array(); 51 var item = 0; 52/* 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__ ); 61 62 array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ ); 63*/ 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 ); 72 73 array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype ); 74 75 76 return ( array ); 77} 78function test() { 79 for ( tc=0; tc < testcases.length; tc++ ) { 80 81 testcases[tc].passed = writeTestCaseResult( 82 testcases[tc].expect, 83 testcases[tc].actual, 84 testcases[tc].description +" = "+ testcases[tc].actual ); 85 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; 86 } 87 88 stopTest(); 89 return ( testcases ); 90} 91 92function MyObject( value ) { 93 this.value = value; 94 this.valueOf = new Function( "return this.value" ); 95} 96