mirror of
https://github.com/denoland/deno.git
synced 2025-02-25 06:32:41 -05:00
Add tests for ctime
This commit is contained in:
parent
98dd346524
commit
e66d2c9719
1 changed files with 10 additions and 1 deletions
|
@ -21,6 +21,7 @@ Deno.test({ permissions: { read: true } }, function fstatSyncSuccess() {
|
|||
assert(fileInfo.mtime);
|
||||
// The `birthtime` field is not available on Linux before kernel version 4.11.
|
||||
assert(fileInfo.birthtime || Deno.build.os === "linux");
|
||||
assert(fileInfo.ctime);
|
||||
});
|
||||
|
||||
Deno.test({ permissions: { read: true } }, async function fstatSuccess() {
|
||||
|
@ -34,6 +35,7 @@ Deno.test({ permissions: { read: true } }, async function fstatSuccess() {
|
|||
assert(fileInfo.mtime);
|
||||
// The `birthtime` field is not available on Linux before kernel version 4.11.
|
||||
assert(fileInfo.birthtime || Deno.build.os === "linux");
|
||||
assert(fileInfo.ctime);
|
||||
});
|
||||
|
||||
Deno.test(
|
||||
|
@ -59,6 +61,7 @@ Deno.test(
|
|||
assert(
|
||||
tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000,
|
||||
);
|
||||
assert(tempInfo.ctime !== null && now - tempInfo.ctime.valueOf() < 1000);
|
||||
|
||||
const readmeInfoByUrl = Deno.statSync(pathToAbsoluteFileUrl("README.md"));
|
||||
assert(readmeInfoByUrl.isFile);
|
||||
|
@ -93,6 +96,9 @@ Deno.test(
|
|||
tempInfoByUrl.birthtime === null ||
|
||||
now - tempInfoByUrl.birthtime.valueOf() < 1000,
|
||||
);
|
||||
assert(tempInfoByUrl.ctime !== null &&
|
||||
now - tempInfoByUrl.ctime.valueOf() < 1000
|
||||
);
|
||||
|
||||
Deno.removeSync(tempFile, { recursive: true });
|
||||
Deno.removeSync(tempFileForUrl, { recursive: true });
|
||||
|
@ -199,6 +205,7 @@ Deno.test(
|
|||
assert(
|
||||
tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000,
|
||||
);
|
||||
assert(tempInfo.ctime !== null && now - tempInfo.ctime.valueOf() < 1000);
|
||||
|
||||
const tempFileForUrl = await Deno.makeTempFile();
|
||||
const tempInfoByUrl = await Deno.stat(
|
||||
|
@ -219,7 +226,9 @@ Deno.test(
|
|||
tempInfoByUrl.birthtime === null ||
|
||||
now - tempInfoByUrl.birthtime.valueOf() < 1000,
|
||||
);
|
||||
|
||||
assert(tempInfoByUrl.ctime !== null &&
|
||||
now - tempInfoByUrl.ctime.valueOf() < 1000
|
||||
);
|
||||
Deno.removeSync(tempFile, { recursive: true });
|
||||
Deno.removeSync(tempFileForUrl, { recursive: true });
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue