|
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 UBound = 0; |
|
20 var BUGNUMBER = 114491; |
|
21 var summary = 'Regression test for bug 114491'; |
|
22 var status = ''; |
|
23 var statusitems = []; |
|
24 var actual = ''; |
|
25 var actualvalues = []; |
|
26 var expect= ''; |
|
27 var expectedvalues = []; |
|
28 |
|
29 |
|
30 status = inSection(1); |
|
31 actual = 'Program execution did NOT fall into catch-block'; |
|
32 expect = 'Program execution fell into into catch-block'; |
|
33 try |
|
34 { |
|
35 var sEval = 'if (true) function f(){}()'; |
|
36 eval(sEval); |
|
37 } |
|
38 catch(e) |
|
39 { |
|
40 actual = expect; |
|
41 } |
|
42 addThis(); |
|
43 |
|
44 |
|
45 |
|
46 //----------------------------------------------------------------------------- |
|
47 test(); |
|
48 //----------------------------------------------------------------------------- |
|
49 |
|
50 |
|
51 function addThis() |
|
52 { |
|
53 statusitems[UBound] = status; |
|
54 actualvalues[UBound] = actual; |
|
55 expectedvalues[UBound] = expect; |
|
56 UBound++; |
|
57 } |
|
58 |
|
59 |
|
60 function test() |
|
61 { |
|
62 enterFunc ('test'); |
|
63 printBugNumber(BUGNUMBER); |
|
64 printStatus (summary); |
|
65 |
|
66 for (var i = 0; i < UBound; i++) |
|
67 { |
|
68 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
|
69 } |
|
70 |
|
71 exitFunc ('test'); |
|
72 } |