summaryrefslogtreecommitdiff
path: root/tests/testdata/run/stdout_write_all.ts
blob: cfb2981e401de0c83f1884db0dd10520110d6894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const encoder = new TextEncoder();

const pending = [];

// do this a bunch of times to ensure it doesn't race
// and everything happens in order
for (let i = 0; i < 100; i++) {
  pending.push(Deno.stdout.write(encoder.encode("Hello, ")));
  pending.push(Deno.stdout.write(encoder.encode(`world! ${i}`)));
  pending.push(Deno.stdout.write(encoder.encode("\n")));
}

await Promise.all(pending);