Debian Codegraph @

rhino/testsrc/tests/js1_7/block/regress-344601.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-344601.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 344601;
9 var summary = 'Function.prototype.toString should preserve let statements';
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 function f() { var i = 1; let (i = 2) {} return i; }
25 var fString = f.toString();
26
27 expect = 'function f() {\n var i = 1;\n let (i = 2) {\n }\n return i;\n}';
28 actual = fString;
29
30 reportCompare(expect, actual, summary);
31
32 expect = f();
33 eval(f.toString().replace(/function f/, 'function g'));
34 actual = g();
35 reportCompare(expect, actual, summary);
36
37 exitFunc ('test');
38 }