1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

chore(ext/buffer): remove use of deprecated Deno.readAll() (#22874)

This commit is contained in:
Asher Gomez 2024-03-21 04:39:17 +11:00 committed by GitHub
parent fb0744f4e1
commit d66154d42a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 4 deletions

View file

@ -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",

View file

@ -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,
});