mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
chore(ext/buffer): remove use of deprecated Deno.readAll()
(#22874)
This commit is contained in:
parent
fb0744f4e1
commit
d66154d42a
2 changed files with 28 additions and 4 deletions
|
@ -59,7 +59,13 @@ Deno.test(
|
||||||
const command = new Deno.Command(Deno.execPath(), {
|
const command = new Deno.Command(Deno.execPath(), {
|
||||||
args: [
|
args: [
|
||||||
"eval",
|
"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",
|
stdin: "piped",
|
||||||
stdout: "null",
|
stdout: "null",
|
||||||
|
@ -214,7 +220,13 @@ Deno.test(
|
||||||
const command = new Deno.Command(Deno.execPath(), {
|
const command = new Deno.Command(Deno.execPath(), {
|
||||||
args: [
|
args: [
|
||||||
"eval",
|
"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",
|
stdin: "piped",
|
||||||
stdout: "null",
|
stdout: "null",
|
||||||
|
|
|
@ -220,7 +220,13 @@ Deno.test(
|
||||||
cmd: [
|
cmd: [
|
||||||
Deno.execPath(),
|
Deno.execPath(),
|
||||||
"eval",
|
"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",
|
stdin: "piped",
|
||||||
});
|
});
|
||||||
|
@ -402,7 +408,13 @@ Deno.test(
|
||||||
cmd: [
|
cmd: [
|
||||||
Deno.execPath(),
|
Deno.execPath(),
|
||||||
"eval",
|
"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,
|
stdin: file.rid,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue