summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-09-03 18:35:54 +1000
committerGitHub <noreply@github.com>2024-09-03 18:35:54 +1000
commit45c1737531be882947e2f62038c0b72fbac921e3 (patch)
tree4dc3336a5d6bc74b7b5190ba49e771fd00d9ff20 /tests
parent259752537f5c81101c47a547ae345f0863235cf6 (diff)
BREAKING(io): remove `Deno.iter[Sync]()` (#25346)
Towards #22079
Diffstat (limited to 'tests')
-rw-r--r--tests/specs/future/runtime_api/main.js2
-rw-r--r--tests/specs/future/runtime_api/main.out2
-rw-r--r--tests/unit/files_test.ts136
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 },
},