diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-08-26 22:58:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 23:58:28 +0200 |
commit | ba58628601057c6f996cbad287fcfbe353872368 (patch) | |
tree | 5642806d3aed1d46eab233511ef8a929cf0c51d3 /tests/unit/files_test.ts | |
parent | 631d931973fbb7d2e01e1aeb87a33dd9d63ec38e (diff) |
Reland "test: run unit tests with DENO_FUTURE=1" (#25212)
Reverted in https://github.com/denoland/deno/pull/25060
Diffstat (limited to 'tests/unit/files_test.ts')
-rw-r--r-- | tests/unit/files_test.ts | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index 754c6fb15..71c5a4561 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -7,6 +7,7 @@ import { assertEquals, assertRejects, assertThrows, + DENO_FUTURE, } from "./test_util.ts"; import { copy } from "@std/io/copy"; @@ -18,31 +19,37 @@ Deno.test(function filesStdioFileDescriptors() { assertEquals(Deno.stderr.rid, 2); }); -Deno.test({ permissions: { read: true } }, async function filesCopyToStdout() { - const filename = "tests/testdata/assets/fixture.json"; - using file = await Deno.open(filename); - assert(file instanceof Deno.File); - assert(file instanceof Deno.FsFile); - assert(file.rid > 2); - const bytesWritten = await copy(file, Deno.stdout); - const fileSize = Deno.statSync(filename).size; - assertEquals(bytesWritten, fileSize); -}); +Deno.test( + { ignore: DENO_FUTURE, permissions: { read: true } }, + async function filesCopyToStdout() { + const filename = "tests/testdata/assets/fixture.json"; + using file = await Deno.open(filename); + assert(file instanceof Deno.File); + assert(file instanceof Deno.FsFile); + assert(file.rid > 2); + const bytesWritten = await copy(file, Deno.stdout); + const fileSize = Deno.statSync(filename).size; + assertEquals(bytesWritten, fileSize); + }, +); -Deno.test({ permissions: { read: true } }, async function filesIter() { - const filename = "tests/testdata/assets/hello.txt"; - using file = await Deno.open(filename); +Deno.test( + { ignore: DENO_FUTURE, permissions: { read: true } }, + async function filesIter() { + const filename = "tests/testdata/assets/hello.txt"; + using file = await Deno.open(filename); - let totalSize = 0; - for await (const buf of Deno.iter(file)) { - totalSize += buf.byteLength; - } + let totalSize = 0; + for await (const buf of Deno.iter(file)) { + totalSize += buf.byteLength; + } - assertEquals(totalSize, 12); -}); + assertEquals(totalSize, 12); + }, +); Deno.test( - { permissions: { read: true } }, + { ignore: DENO_FUTURE, permissions: { read: true } }, async function filesIterCustomBufSize() { const filename = "tests/testdata/assets/hello.txt"; using file = await Deno.open(filename); @@ -59,20 +66,23 @@ Deno.test( }, ); -Deno.test({ permissions: { read: true } }, function filesIterSync() { - const filename = "tests/testdata/assets/hello.txt"; - using file = Deno.openSync(filename); +Deno.test( + { ignore: DENO_FUTURE, permissions: { read: true } }, + function filesIterSync() { + const filename = "tests/testdata/assets/hello.txt"; + using file = Deno.openSync(filename); - let totalSize = 0; - for (const buf of Deno.iterSync(file)) { - totalSize += buf.byteLength; - } + let totalSize = 0; + for (const buf of Deno.iterSync(file)) { + totalSize += buf.byteLength; + } - assertEquals(totalSize, 12); -}); + assertEquals(totalSize, 12); + }, +); Deno.test( - { permissions: { read: true } }, + { ignore: DENO_FUTURE, permissions: { read: true } }, function filesIterSyncCustomBufSize() { const filename = "tests/testdata/assets/hello.txt"; using file = Deno.openSync(filename); @@ -89,7 +99,7 @@ Deno.test( }, ); -Deno.test(async function readerIter() { +Deno.test({ ignore: DENO_FUTURE }, async function readerIter() { // ref: https://github.com/denoland/deno/issues/2330 const encoder = new TextEncoder(); @@ -124,7 +134,7 @@ Deno.test(async function readerIter() { assertEquals(totalSize, 12); }); -Deno.test(async function readerIterSync() { +Deno.test({ ignore: DENO_FUTURE }, async function readerIterSync() { // ref: https://github.com/denoland/deno/issues/2330 const encoder = new TextEncoder(); |