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 [[Class]] property of native error types.
23 * See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
25 * Same as class-001.js - but testing only the native error types here.
26 * See ECMA-262 Edition 3, Section 15.11.6 for a list of these types.
28 * ECMA expects the [[Class]] property to equal 'Error' in each case.
29 * See ECMA-262 Edition 3, Sections 15.11.1.1 and 15.11.7.2 for this.
30 * See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
32 * The getJSClass() function we use is in a utility file, e.g. "shell.js"
34 //-------------------------------------------------------------------------------------------------
38 var summary = 'Testing the internal [[Class]] property of native error types';
39 var statprefix = 'Current object is: ';
40 var status = ''; var statusList = [ ];
41 var actual = ''; var actualvalue = [ ];
42 var expect= ''; var expectedvalue = [ ];
45 * We set the expect variable each time only for readability.
46 * We expect 'Error' every time; see discussion above -
48 status = 'new Error()';
49 actual = getJSClass(new Error());
53 status = 'new EvalError()';
54 actual = getJSClass(new EvalError());
58 status = 'new RangeError()';
59 actual = getJSClass(new RangeError());
63 status = 'new ReferenceError()';
64 actual = getJSClass(new ReferenceError());
68 status = 'new SyntaxError()';
69 actual = getJSClass(new SyntaxError());
73 status = 'new TypeError()';
74 actual = getJSClass(new TypeError());
78 status = 'new URIError()';
79 actual = getJSClass(new URIError());
85 //---------------------------------------------------------------------------------
87 //---------------------------------------------------------------------------------
93 statusList[UBound] = status;
94 actualvalue[UBound] = actual;
95 expectedvalue[UBound] = expect;
103 printBugNumber (bug);
104 printStatus (summary);
106 for (i = 0; i < UBound; i++)
108 reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
115 function getStatus(i)
117 return statprefix + statusList[i];