From 62786cfebb5c9fe36d0930582951f442bdfe9441 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 25 Jan 2024 01:59:55 +1100 Subject: feat: deprecate `Deno.close()` (#22066) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For removal in Deno v2. --------- Co-authored-by: Bartek IwaƄczuk --- cli/tests/unit_node/_fs/_fs_writeFile_test.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'cli/tests/unit_node/_fs/_fs_writeFile_test.ts') diff --git a/cli/tests/unit_node/_fs/_fs_writeFile_test.ts b/cli/tests/unit_node/_fs/_fs_writeFile_test.ts index e4bb41d9e..0bff90594 100644 --- a/cli/tests/unit_node/_fs/_fs_writeFile_test.ts +++ b/cli/tests/unit_node/_fs/_fs_writeFile_test.ts @@ -107,7 +107,7 @@ Deno.test( "Data is written to correct rid", async function testCorrectWriteUsingRid() { const tempFile: string = await Deno.makeTempFile(); - const file: Deno.FsFile = await Deno.open(tempFile, { + using file = await Deno.open(tempFile, { create: true, write: true, read: true, @@ -119,7 +119,6 @@ Deno.test( resolve(); }); }); - Deno.close(file.rid); const data = await Deno.readFile(tempFile); await Deno.remove(tempFile); @@ -213,7 +212,7 @@ Deno.test( if (Deno.build.os === "windows") return; const filename: string = await Deno.makeTempFile(); - const file: Deno.FsFile = await Deno.open(filename, { + using file = await Deno.open(filename, { create: true, write: true, read: true, @@ -225,7 +224,6 @@ Deno.test( resolve(); }); }); - Deno.close(file.rid); const fileInfo = await Deno.stat(filename); await Deno.remove(filename); @@ -264,14 +262,13 @@ Deno.test( "Data is written synchronously to correct rid", function testCorrectWriteSyncUsingRid() { const tempFile: string = Deno.makeTempFileSync(); - const file: Deno.FsFile = Deno.openSync(tempFile, { + using file = Deno.openSync(tempFile, { create: true, write: true, read: true, }); writeFileSync(file.rid, "hello world"); - Deno.close(file.rid); const data = Deno.readFileSync(tempFile); Deno.removeSync(tempFile); -- cgit v1.2.3