summaryrefslogtreecommitdiff
path: root/cli/tests/unit/utime_test.ts
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-22 10:20:59 +1100
committerGitHub <noreply@github.com>2024-01-22 00:20:59 +0100
commit983c745d4f385594638c42c107dca7d55afd0731 (patch)
tree2c184d26ea3344b82543117d25bb99e49ba876e9 /cli/tests/unit/utime_test.ts
parent568337f3f43ef050cbbd95995f94e39663530ab4 (diff)
chore: use `FsFile[Symbol.dispose]()` (#22007)
This change takes advantage of explicit resources management for `FsFile` instances and tweaks documentation to encourage the use of it. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Diffstat (limited to 'cli/tests/unit/utime_test.ts')
-rw-r--r--cli/tests/unit/utime_test.ts6
1 files changed, 2 insertions, 4 deletions
diff --git a/cli/tests/unit/utime_test.ts b/cli/tests/unit/utime_test.ts
index 2375f2d79..02566bad6 100644
--- a/cli/tests/unit/utime_test.ts
+++ b/cli/tests/unit/utime_test.ts
@@ -11,7 +11,7 @@ Deno.test(
async function futimeSyncSuccess() {
const testDir = await Deno.makeTempDir();
const filename = testDir + "/file.txt";
- const file = await Deno.open(filename, {
+ using file = await Deno.open(filename, {
create: true,
write: true,
});
@@ -24,7 +24,6 @@ Deno.test(
const fileInfo = Deno.statSync(filename);
assertEquals(fileInfo.atime, new Date(atime * 1000));
assertEquals(fileInfo.mtime, new Date(mtime * 1000));
- file.close();
},
);
@@ -33,7 +32,7 @@ Deno.test(
function futimeSyncSuccess() {
const testDir = Deno.makeTempDirSync();
const filename = testDir + "/file.txt";
- const file = Deno.openSync(filename, {
+ using file = Deno.openSync(filename, {
create: true,
write: true,
});
@@ -46,7 +45,6 @@ Deno.test(
const fileInfo = Deno.statSync(filename);
assertEquals(fileInfo.atime, new Date(atime * 1000));
assertEquals(fileInfo.mtime, new Date(mtime * 1000));
- file.close();
},
);