Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-317533.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-317533.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 317533;
9 var summary = 'improve function does not always return a value warnings';
10 var actual = '';
11 var expect = 'TypeError: anonymous function does not always return a value';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 var code;
17
18 if (!options().match(/strict/))
19 {
20 options('strict');
21 }
22 if (!options().match(/werror/))
23 {
24 options('werror');
25 }
26
27 try
28 {
29 actual = '';
30 code = "(function(x){ if(x) return x; })";
31 print(code);
32 eval(code);
33 }
34 catch(ex)
35 {
36 actual = ex + '';
37 print(ex);
38 }
39
40 reportCompare(expect, actual, summary);
41
42 try
43 {
44 actual = '';
45 code = "(function(x){ if(x) return x; ;})";
46 print(code);
47 eval(code);
48 }
49 catch(ex)
50 {
51 actual = ex + '';
52 print(ex);
53 }
54
55 reportCompare(expect, actual, summary);