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
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * 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.
17 * All Rights Reserved.
19 * Contributor(s): pschwartau@netscape.com
20 * Date: 13 August 2001
22 * SUMMARY: Invoking an undefined function should produce a ReferenceError
23 * See http://bugzilla.mozilla.org/show_bug.cgi?id=95101
25 //-----------------------------------------------------------------------------
28 var summary = 'Invoking an undefined function should produce a ReferenceError';
29 var msgERR_REF_YES = 'ReferenceError';
30 var msgERR_REF_NO = 'did NOT generate a ReferenceError';
34 var actualvalues = [];
36 var expectedvalues = [];
45 status = 'Section 1 of test';
46 actual = e instanceof ReferenceError;
52 * This test is more literal, and may one day be invalid.
53 * Searching for literal string "ReferenceError" in e.toString()
55 status = 'Section 2 of test';
56 var match = e.toString().search(/ReferenceError/);
57 actual = (match > -1);
64 //-----------------------------------------------------------------------------
66 //-----------------------------------------------------------------------------
71 statusitems[UBound] = status;
72 actualvalues[UBound] = isReferenceError(actual);
73 expectedvalues[UBound] = isReferenceError(expect);
82 printStatus (summary);
84 for (var i = 0; i < UBound; i++)
86 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
93 // converts a Boolean result into a textual result -
94 function isReferenceError(bResult)
96 return bResult? msgERR_REF_YES : msgERR_REF_NO;