Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 347559;
8 var summary = 'Let declarations should not warn that function does not ' +
9 'return a value';
10 var actual = '';
11 var expect = '';
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
24 actual = 'No Warning';
25 expect = 'No Warning';
27 if (!options().match(/strict/))
28 {
29 options('strict');
30 }
31 if (!options().match(/werror/))
32 {
33 options('werror');
34 }
36 try
37 {
38 eval('function f() { let a = 2; return a; }');
39 }
40 catch(ex)
41 {
42 actual = ex + '';
43 }
45 reportCompare(expect, actual, summary + ': 1');
47 actual = 'No Warning';
48 expect = 'TypeError: function f does not always return a value';
50 try
51 {
52 eval('function f() { if (asdf) return 3; let x; }');
53 }
54 catch(ex)
55 {
56 actual = ex + '';
57 }
59 reportCompare(expect, actual, summary + ': 2');
61 actual = 'No Warning';
62 expect = 'No Warning';
64 try
65 {
66 eval('function f() { if (asdf) return 3; let (x) { return 4; } }');
67 }
68 catch(ex)
69 {
70 actual = ex + '';
71 }
73 reportCompare(expect, actual, summary + ': 3');
75 exitFunc ('test');
76 }