Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-114491.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 *
8 * Date: 10 December 2001
9 * SUMMARY: Regression test for bug 114491
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=114491
11 *
12 * Rhino crashed on this code. It should produce a syntax error, not a crash.
13 * Using the () operator after a function STATEMENT is incorrect syntax.
14 * Rhino correctly caught the error when there was no |if (true)|.
15 * With the |if (true)|, however, Rhino crashed -
16 *
17 */
18 //-----------------------------------------------------------------------------
19 var gTestfile = 'regress-114491.js';
20 var UBound = 0;
21 var BUGNUMBER = 114491;
22 var summary = 'Regression test for bug 114491';
23 var status = '';
24 var statusitems = [];
25 var actual = '';
26 var actualvalues = [];
27 var expect= '';
28 var expectedvalues = [];
29
30
31 status = inSection(1);
32 actual = 'Program execution did NOT fall into catch-block';
33 expect = 'Program execution fell into into catch-block';
34 try
35 {
36 var sEval = 'if (true) function f(){}()';
37 eval(sEval);
38 }
39 catch(e)
40 {
41 actual = expect;
42 }
43 addThis();
44
45
46
47 //-----------------------------------------------------------------------------
48 test();
49 //-----------------------------------------------------------------------------
50
51
52 function addThis()
53 {
54 statusitems[UBound] = status;
55 actualvalues[UBound] = actual;
56 expectedvalues[UBound] = expect;
57 UBound++;
58 }
59
60
61 function test()
62 {
63 enterFunc ('test');
64 printBugNumber(BUGNUMBER);
65 printStatus (summary);
66
67 for (var i = 0; i < UBound; i++)
68 {
69 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
70 }
71
72 exitFunc ('test');
73 }