mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
Fix trace test code
This commit is contained in:
parent
f156a86024
commit
3c24b9f724
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@ testPerm({ write: true }, async function traceFunctionSuccess() {
|
||||||
// Mixing sync and async calls
|
// Mixing sync and async calls
|
||||||
const filename = deno.makeTempDirSync() + "/test.txt";
|
const filename = deno.makeTempDirSync() + "/test.txt";
|
||||||
await deno.writeFile(filename, data, 0o666);
|
await deno.writeFile(filename, data, 0o666);
|
||||||
await deno.removeSync(filename);
|
deno.removeSync(filename);
|
||||||
});
|
});
|
||||||
assertEqual(op.length, 3);
|
assertEqual(op.length, 3);
|
||||||
assertEqual(op[0], { sync: true, name: "MakeTempDir" });
|
assertEqual(op[0], { sync: true, name: "MakeTempDir" });
|
||||||
|
@ -25,7 +25,7 @@ testPerm({ write: true }, async function tracePromiseSuccess() {
|
||||||
// Mixing sync and async calls
|
// Mixing sync and async calls
|
||||||
const filename = deno.makeTempDirSync() + "/test.txt";
|
const filename = deno.makeTempDirSync() + "/test.txt";
|
||||||
await deno.writeFile(filename, data, 0o666);
|
await deno.writeFile(filename, data, 0o666);
|
||||||
await deno.removeSync(filename);
|
deno.removeSync(filename);
|
||||||
};
|
};
|
||||||
const promise = Promise.resolve().then(asyncFunction);
|
const promise = Promise.resolve().then(asyncFunction);
|
||||||
const op = await deno.trace(promise);
|
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());
|
const op1 = await deno.trace(async () => await deno.makeTempDir());
|
||||||
assertEqual(op1.length, 1);
|
assertEqual(op1.length, 1);
|
||||||
assertEqual(op1[0], { sync: false, name: "MakeTempDir" });
|
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.length, 1);
|
||||||
assertEqual(op2[0], { sync: true, name: "Stat" });
|
assertEqual(op2[0], { sync: true, name: "Stat" });
|
||||||
});
|
});
|
||||||
|
@ -75,7 +75,7 @@ testPerm({ write: true }, async function traceIdempotence() {
|
||||||
assertEqual(op3[0], { sync: false, name: "Remove" });
|
assertEqual(op3[0], { sync: false, name: "Remove" });
|
||||||
|
|
||||||
// Expect top-level repeat still works after all the nestings
|
// 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.length, 1);
|
||||||
assertEqual(op4[0], { sync: true, name: "Stat" });
|
assertEqual(op4[0], { sync: true, name: "Stat" });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue