Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-376052.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 var gTestfile = 'regress-376052.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 376052;
9 var summary = 'javascript.options.anonfunfix to allow function (){} expressions';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 if (typeof window != 'undefined')
25 {
26 print('Test skipped. anonfunfix not configurable in browser.');
27 reportCompare(expect, actual, summary);
28 }
29 else
30 {
31 expect = 'No Error';
32 try
33 {
34 eval('function () {1;}');
35 actual = 'No Error';
36 }
37 catch(ex)
38 {
39 actual = ex + '';
40 }
41 reportCompare(expect, actual, summary + ': 1');
42
43 options('anonfunfix');
44
45 expect = 'No Error';
46 try
47 {
48 eval('(function () {1;})');
49 actual = 'No Error';
50 }
51 catch(ex)
52 {
53 actual = ex + '';
54 }
55 reportCompare(expect, actual, summary + ': 2');
56
57 expect = 'SyntaxError: syntax error';
58 try
59 {
60 eval('function () {1;}');
61 actual = 'No Error';
62 }
63 catch(ex)
64 {
65 actual = ex + '';
66 }
67 reportCompare(expect, actual, summary + ': 3');
68
69 }
70
71 exitFunc ('test');
72 }