2 * The contents of this file are subject to the Netscape Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/NPL/
7 * Software distributed under the License is distributed on an "AS IS"
8 * basis, WITHOUT WARRANTY OF ANY KIND, either expressed
9 * or implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is mozilla.org code.
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
19 * Contributor(s): pschwartau@netscape.com
22 * SUMMARY: Testing the internal [[Class]] property of objects
23 * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2
25 * The getJSClass() function we use is in a utility file, e.g. "shell.js".
27 //-------------------------------------------------------------------------------------------------
31 var summary = 'Testing the internal [[Class]] property of objects';
32 var statprefix = 'Current object is: ';
33 var status = ''; var statusList = [ ];
34 var actual = ''; var actualvalue = [ ];
35 var expect= ''; var expectedvalue = [ ];
38 status = 'the global object';
39 actual = getJSClass(this);
43 status = 'new Object()';
44 actual = getJSClass(new Object());
48 status = 'new Function()';
49 actual = getJSClass(new Function());
53 status = 'new Array()';
54 actual = getJSClass(new Array());
58 status = 'new String()';
59 actual = getJSClass(new String());
63 status = 'new Boolean()';
64 actual = getJSClass(new Boolean());
68 status = 'new Number()';
69 actual = getJSClass(new Number());
74 actual = getJSClass(Math); // can't use 'new' with the Math object (EMCA3, 15.8)
78 status = 'new Date()';
79 actual = getJSClass(new Date());
83 status = 'new RegExp()';
84 actual = getJSClass(new RegExp());
88 status = 'new Error()';
89 actual = getJSClass(new Error());
95 //---------------------------------------------------------------------------------
97 //---------------------------------------------------------------------------------
103 statusList[UBound] = status;
104 actualvalue[UBound] = actual;
105 expectedvalue[UBound] = expect;
113 printBugNumber (bug);
114 printStatus (summary);
116 for (i = 0; i < UBound; i++)
118 reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
125 function getStatus(i)
127 return statprefix + statusList[i];