summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-03-21 04:39:17 +1100
committerGitHub <noreply@github.com>2024-03-20 10:39:17 -0700
commitd66154d42a8e0f044ef8cab7947c5a4909782184 (patch)
tree40b19e5f1b3a6b339b04fb7dd959740c39feefd5
parentfb0744f4e1ad08597d194fdf99f5a786cd62569c (diff)
chore(ext/buffer): remove use of deprecated `Deno.readAll()` (#22874)
-rw-r--r--tests/unit/command_test.ts16
-rw-r--r--tests/unit/process_test.ts16
2 files changed, 28 insertions, 4 deletions
diff --git a/tests/unit/command_test.ts b/tests/unit/command_test.ts
index cbb1c4921..770a568c4 100644
--- a/tests/unit/command_test.ts
+++ b/tests/unit/command_test.ts
@@ -59,7 +59,13 @@ Deno.test(
const command = new Deno.Command(Deno.execPath(), {
args: [
"eval",
- "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')",
+ `
+ const buffer = new Uint8Array(5);
+ await Deno.stdin.read(buffer);
+ if (new TextDecoder().decode(buffer) !== "hello") {
+ throw new Error('Expected \\'hello\\'')
+ }
+ `,
],
stdin: "piped",
stdout: "null",
@@ -214,7 +220,13 @@ Deno.test(
const command = new Deno.Command(Deno.execPath(), {
args: [
"eval",
- "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')",
+ `
+ const buffer = new Uint8Array(5);
+ await Deno.stdin.read(buffer);
+ if (new TextDecoder().decode(buffer) !== "hello") {
+ throw new Error('Expected \\'hello\\'')
+ }
+ `,
],
stdin: "piped",
stdout: "null",
diff --git a/tests/unit/process_test.ts b/tests/unit/process_test.ts
index 0cc4e99aa..040c6ee19 100644
--- a/tests/unit/process_test.ts
+++ b/tests/unit/process_test.ts
@@ -220,7 +220,13 @@ Deno.test(
cmd: [
Deno.execPath(),
"eval",
- "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')",
+ `
+ const buffer = new Uint8Array(5);
+ await Deno.stdin.read(buffer);
+ if (new TextDecoder().decode(buffer) !== "hello") {
+ throw new Error('Expected \\'hello\\'')
+ }
+ `,
],
stdin: "piped",
});
@@ -402,7 +408,13 @@ Deno.test(
cmd: [
Deno.execPath(),
"eval",
- "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')",
+ `
+ const buffer = new Uint8Array(5);
+ await Deno.stdin.read(buffer);
+ if (new TextDecoder().decode(buffer) !== "hello") {
+ throw new Error('Expected \\'hello\\'')
+ }
+ `,
],
stdin: file.rid,
});