Debian Codegraph @

rhino/testsrc/tests/ecma_3/Exceptions/regress-95101.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * Date: 13 August 2001
8 *
9 * SUMMARY: Invoking an undefined function should produce a ReferenceError
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=95101
11 */
12 //-----------------------------------------------------------------------------
13 var gTestfile = 'regress-95101.js';
14 var UBound = 0;
15 var BUGNUMBER = 95101;
16 var summary = 'Invoking an undefined function should produce a ReferenceError';
17 var msgERR_REF_YES = 'ReferenceError';
18 var msgERR_REF_NO = 'did NOT generate a ReferenceError';
19 var status = '';
20 var statusitems = [];
21 var actual = '';
22 var actualvalues = [];
23 var expect= '';
24 var expectedvalues = [];
25
26
27 try
28 {
29 xxxyyyzzz();
30 }
31 catch (e)
32 {
33 status = 'Section 1 of test';
34 actual = e instanceof ReferenceError;
35 expect = true;
36 addThis();
37
38
39 /*
40 * This test is more literal, and may one day be invalid.
41 * Searching for literal string "ReferenceError" in e.toString()
42 */
43 status = 'Section 2 of test';
44 var match = e.toString().search(/ReferenceError/);
45 actual = (match > -1);
46 expect = true;
47 addThis();
48 }
49
50
51
52 //-----------------------------------------------------------------------------
53 test();
54 //-----------------------------------------------------------------------------
55
56
57 function addThis()
58 {
59 statusitems[UBound] = status;
60 actualvalues[UBound] = isReferenceError(actual);
61 expectedvalues[UBound] = isReferenceError(expect);
62 UBound++;
63 }
64
65
66 function test()
67 {
68 enterFunc ('test');
69 printBugNumber(BUGNUMBER);
70 printStatus (summary);
71
72 for (var i = 0; i < UBound; i++)
73 {
74 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
75 }
76
77 exitFunc ('test');
78 }
79
80
81 // converts a Boolean result into a textual result -
82 function isReferenceError(bResult)
83 {
84 return bResult? msgERR_REF_YES : msgERR_REF_NO;
85 }