summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
});