1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

Fix trace test code

This commit is contained in:
J2P 2018-09-25 23:40:37 +09:00 committed by Ryan Dahl
parent f156a86024
commit 3c24b9f724

View file

@ -8,7 +8,7 @@ testPerm({ write: true }, async function traceFunctionSuccess() {
// Mixing sync and async calls
const filename = deno.makeTempDirSync() + "/test.txt";
await deno.writeFile(filename, data, 0o666);
await deno.removeSync(filename);
deno.removeSync(filename);
});
assertEqual(op.length, 3);
assertEqual(op[0], { sync: true, name: "MakeTempDir" });
@ -25,7 +25,7 @@ testPerm({ write: true }, async function tracePromiseSuccess() {
// Mixing sync and async calls
const filename = deno.makeTempDirSync() + "/test.txt";
await deno.writeFile(filename, data, 0o666);
await deno.removeSync(filename);
deno.removeSync(filename);
};
const promise = Promise.resolve().then(asyncFunction);
const op = await deno.trace(promise);
@ -39,7 +39,7 @@ testPerm({ write: true }, async function traceRepeatSuccess() {
const op1 = await deno.trace(async () => await deno.makeTempDir());
assertEqual(op1.length, 1);
assertEqual(op1[0], { sync: false, name: "MakeTempDir" });
const op2 = await deno.trace(async () => await deno.statSync("."));
const op2 = await deno.trace(() => deno.statSync("."));
assertEqual(op2.length, 1);
assertEqual(op2[0], { sync: true, name: "Stat" });
});
@ -75,7 +75,7 @@ testPerm({ write: true }, async function traceIdempotence() {
assertEqual(op3[0], { sync: false, name: "Remove" });
// Expect top-level repeat still works after all the nestings
const op4 = await deno.trace(async () => await deno.statSync("."));
const op4 = await deno.trace(() => deno.statSync("."));
assertEqual(op4.length, 1);
assertEqual(op4[0], { sync: true, name: "Stat" });
});