Debian Codegraph @

js/src/tests/non262/arrow-functions/toString-eof.js

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 function test(code) {
6 assertEq(eval(code).toString(), code);
7
8 assertEq(eval(code + ` `).toString(), code);
9 assertEq(eval(code + ` \n`).toString(), code);
10
11 assertEq(eval(code + ` // foo`).toString(), code);
12 assertEq(eval(code + ` // foo
13 `).toString(), code);
14 assertEq(eval(code + ` // foo
15 // foo`).toString(), code);
16 assertEq(eval(code + ` // foo
17 // foo
18 `).toString(), code);
19 }
20 test(`() => 1`);
21 test(`() => () => 2`);
22 test(`() => class {}`);
23 test(`() => function() {}`);
24
25 if (typeof reportCompare === "function")
26 reportCompare(true, true);