mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 20:59:10 +00:00
BREAKING(std): reorganization (#5087)
* Prepend underscores to private modules * Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result. * Move std/_util/async.ts to std/async * Move std/util/sha*.ts to std/hash
This commit is contained in:
parent
2b02535028
commit
f184332c09
100 changed files with 306 additions and 365 deletions
28
std/async/mux_async_iterator_test.ts
Normal file
28
std/async/mux_async_iterator_test.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { assertEquals } from "../testing/asserts.ts";
|
||||
import { MuxAsyncIterator } from "./mux_async_iterator.ts";
|
||||
|
||||
// eslint-disable-next-line require-await
|
||||
async function* gen123(): AsyncIterableIterator<number> {
|
||||
yield 1;
|
||||
yield 2;
|
||||
yield 3;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line require-await
|
||||
async function* gen456(): AsyncIterableIterator<number> {
|
||||
yield 4;
|
||||
yield 5;
|
||||
yield 6;
|
||||
}
|
||||
|
||||
Deno.test("[async] MuxAsyncIterator", async function (): Promise<void> {
|
||||
const mux = new MuxAsyncIterator<number>();
|
||||
mux.add(gen123());
|
||||
mux.add(gen456());
|
||||
const results = new Set();
|
||||
for await (const value of mux) {
|
||||
results.add(value);
|
||||
}
|
||||
assertEquals(results.size, 6);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue