summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/async-functions/toSource.js
blob: 3cd2943aec5272ee209c6236d158025d1e3d94fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// |reftest| skip-if(!Function.prototype.toSource)

var BUGNUMBER = 1335025;
var summary = "(non-standard) async function toSource";

print(BUGNUMBER + ": " + summary);

async function f1(a, b, c) { await a; }

assertEq(f1.toSource(),
         "async function f1(a, b, c) { await a; }");

assertEq(async function (a, b, c) { await a; }.toSource(),
         "(async function (a, b, c) { await a; })");

assertEq((async (a, b, c) => await a).toSource(),
         "async (a, b, c) => await a");

assertEq((async (a, b, c) => { await a; }).toSource(),
         "async (a, b, c) => { await a; }");

assertEq({ async foo(a, b, c) { await a; } }.foo.toSource(),
         "async foo(a, b, c) { await a; }");

if (typeof reportCompare === "function")
    reportCompare(true, true);