toSource.js (773B)
1 // |reftest| skip-if(!Function.prototype.toSource) 2 3 var BUGNUMBER = 1335025; 4 var summary = "(non-standard) async function toSource"; 5 6 print(BUGNUMBER + ": " + summary); 7 8 async function f1(a, b, c) { await a; } 9 10 assertEq(f1.toSource(), 11 "async function f1(a, b, c) { await a; }"); 12 13 assertEq(async function (a, b, c) { await a; }.toSource(), 14 "(async function (a, b, c) { await a; })"); 15 16 assertEq((async (a, b, c) => await a).toSource(), 17 "async (a, b, c) => await a"); 18 19 assertEq((async (a, b, c) => { await a; }).toSource(), 20 "async (a, b, c) => { await a; }"); 21 22 assertEq({ async foo(a, b, c) { await a; } }.foo.toSource(), 23 "async foo(a, b, c) { await a; }"); 24 25 if (typeof reportCompare === "function") 26 reportCompare(true, true);