]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/Object/class-004.js
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 [[Class]] property of native error constructors.
23 * See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
25 * See ECMA-262 Edition 3, Section 15.11.6 for the native error types.
26 * See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
28 * Same as class-003.js - but testing the constructors here, not object instances.
29 * Therefore we expect the [[Class]] property to equal 'Function' in each case.
31 * The getJSClass() function we use is in a utility file, e.g. "shell.js"
33 //-------------------------------------------------------------------------------------------------
37 var summary
= 'Testing the internal [[Class]] property of native error constructors';
38 var statprefix
= 'Current constructor is: ';
39 var status
= ''; var statusList
= [ ];
40 var actual
= ''; var actualvalue
= [ ];
41 var expect
= ''; var expectedvalue
= [ ];
44 * We set the expect variable each time only for readability.
45 * We expect 'Function' every time; see discussion above -
48 actual
= getJSClass(Error
);
53 actual
= getJSClass(EvalError
);
57 status
= 'RangeError';
58 actual
= getJSClass(RangeError
);
62 status
= 'ReferenceError';
63 actual
= getJSClass(ReferenceError
);
67 status
= 'SyntaxError';
68 actual
= getJSClass(SyntaxError
);
73 actual
= getJSClass(TypeError
);
78 actual
= getJSClass(URIError
);
84 //---------------------------------------------------------------------------------
86 //---------------------------------------------------------------------------------
92 statusList
[UBound
] = status
;
93 actualvalue
[UBound
] = actual
;
94 expectedvalue
[UBound
] = expect
;
102 printBugNumber (bug
);
103 printStatus (summary
);
105 for (i
= 0; i
< UBound
; i
++)
107 reportCompare(expectedvalue
[i
], actualvalue
[i
], getStatus(i
));
114 function getStatus(i
)
116 return statprefix
+ statusList
[i
];