From f55b22e195ff0dfaf117aaef2a0fcc51fe0058c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 29 Feb 2020 18:45:47 +0100 Subject: add assertResources sanitizer to cli/js/ unit tests (#4161) --- cli/js/files_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/js/files_test.ts') diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts index de0d3019a..7e3479798 100644 --- a/cli/js/files_test.ts +++ b/cli/js/files_test.ts @@ -21,6 +21,7 @@ testPerm({ read: true }, async function filesCopyToStdout(): Promise { const fileSize = Deno.statSync(filename).len; assertEquals(bytesWritten, fileSize); console.log("bytes written", bytesWritten); + file.close(); }); testPerm({ read: true }, async function filesToAsyncIterator(): Promise { @@ -33,6 +34,7 @@ testPerm({ read: true }, async function filesToAsyncIterator(): Promise { } assertEquals(totalSize, 12); + file.close(); }); test(async function readerToAsyncIterator(): Promise { @@ -308,6 +310,7 @@ testPerm({ read: true }, async function seekStart(): Promise { await file.read(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, function seekSyncStart(): void { @@ -321,6 +324,7 @@ testPerm({ read: true }, function seekSyncStart(): void { file.readSync(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, async function seekCurrent(): Promise { @@ -334,6 +338,7 @@ testPerm({ read: true }, async function seekCurrent(): Promise { await file.read(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, function seekSyncCurrent(): void { @@ -347,6 +352,7 @@ testPerm({ read: true }, function seekSyncCurrent(): void { file.readSync(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, async function seekEnd(): Promise { @@ -357,6 +363,7 @@ testPerm({ read: true }, async function seekEnd(): Promise { await file.read(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, function seekSyncEnd(): void { @@ -367,6 +374,7 @@ testPerm({ read: true }, function seekSyncEnd(): void { file.readSync(buf); const decoded = new TextDecoder().decode(buf); assertEquals(decoded, "world!"); + file.close(); }); testPerm({ read: true }, async function seekMode(): Promise { @@ -387,4 +395,5 @@ testPerm({ read: true }, async function seekMode(): Promise { const buf = new Uint8Array(1); await file.read(buf); // "H" assertEquals(new TextDecoder().decode(buf), "H"); + file.close(); }); -- cgit v1.2.3