diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/specs/future/runtime_api/main.js | 2 | ||||
-rw-r--r-- | tests/specs/future/runtime_api/main.out | 2 | ||||
-rw-r--r-- | tests/unit/files_test.ts | 136 |
3 files changed, 0 insertions, 140 deletions
diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 503b6e5fb..0c03dab33 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -14,8 +14,6 @@ console.log( ); console.log("Deno.funlock is", Deno.funlock); console.log("Deno.funlockSync is", Deno.funlockSync); -console.log("Deno.iter is", Deno.iter); -console.log("Deno.iterSync is", Deno.iterSync); console.log("Deno.readAll is", Deno.readAll); console.log("Deno.readAllSync is", Deno.readAllSync); console.log("Deno.read is", Deno.read); diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index eca1c3741..f04a0b4e9 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -11,8 +11,6 @@ Deno.flockSync is undefined Deno.FsFile.prototype.rid is undefined Deno.funlock is undefined Deno.funlockSync is undefined -Deno.iter is undefined -Deno.iterSync is undefined Deno.readAll is undefined Deno.readAllSync is undefined Deno.read is undefined diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index 71c5a4561..fb45e3ad6 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -34,142 +34,6 @@ Deno.test( ); 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; - } - - assertEquals(totalSize, 12); - }, -); - -Deno.test( - { ignore: DENO_FUTURE, permissions: { read: true } }, - async function filesIterCustomBufSize() { - const filename = "tests/testdata/assets/hello.txt"; - using file = await Deno.open(filename); - - let totalSize = 0; - let iterations = 0; - for await (const buf of Deno.iter(file, { bufSize: 6 })) { - totalSize += buf.byteLength; - iterations += 1; - } - - assertEquals(totalSize, 12); - assertEquals(iterations, 2); - }, -); - -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; - } - - assertEquals(totalSize, 12); - }, -); - -Deno.test( - { ignore: DENO_FUTURE, permissions: { read: true } }, - function filesIterSyncCustomBufSize() { - const filename = "tests/testdata/assets/hello.txt"; - using file = Deno.openSync(filename); - - let totalSize = 0; - let iterations = 0; - for (const buf of Deno.iterSync(file, { bufSize: 6 })) { - totalSize += buf.byteLength; - iterations += 1; - } - - assertEquals(totalSize, 12); - assertEquals(iterations, 2); - }, -); - -Deno.test({ ignore: DENO_FUTURE }, async function readerIter() { - // ref: https://github.com/denoland/deno/issues/2330 - const encoder = new TextEncoder(); - - class TestReader implements Deno.Reader { - #offset = 0; - #buf: Uint8Array; - - constructor(s: string) { - this.#buf = new Uint8Array(encoder.encode(s)); - } - - read(p: Uint8Array): Promise<number | null> { - const n = Math.min(p.byteLength, this.#buf.byteLength - this.#offset); - p.set(this.#buf.slice(this.#offset, this.#offset + n)); - this.#offset += n; - - if (n === 0) { - return Promise.resolve(null); - } - - return Promise.resolve(n); - } - } - - const reader = new TestReader("hello world!"); - - let totalSize = 0; - for await (const buf of Deno.iter(reader)) { - totalSize += buf.byteLength; - } - - assertEquals(totalSize, 12); -}); - -Deno.test({ ignore: DENO_FUTURE }, async function readerIterSync() { - // ref: https://github.com/denoland/deno/issues/2330 - const encoder = new TextEncoder(); - - class TestReader implements Deno.ReaderSync { - #offset = 0; - #buf: Uint8Array; - - constructor(s: string) { - this.#buf = new Uint8Array(encoder.encode(s)); - } - - readSync(p: Uint8Array): number | null { - const n = Math.min(p.byteLength, this.#buf.byteLength - this.#offset); - p.set(this.#buf.slice(this.#offset, this.#offset + n)); - this.#offset += n; - - if (n === 0) { - return null; - } - - return n; - } - } - - const reader = new TestReader("hello world!"); - - let totalSize = 0; - for await (const buf of Deno.iterSync(reader)) { - totalSize += buf.byteLength; - } - - assertEquals(totalSize, 12); -}); - -Deno.test( { permissions: { read: true, write: true }, }, |