From f184332c09c851faac50f598d29ebe4426e05464 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sat, 9 May 2020 13:34:47 +0100 Subject: 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 --- std/async/mux_async_iterator_test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 std/async/mux_async_iterator_test.ts (limited to 'std/async/mux_async_iterator_test.ts') diff --git a/std/async/mux_async_iterator_test.ts b/std/async/mux_async_iterator_test.ts new file mode 100644 index 000000000..7017a4eba --- /dev/null +++ b/std/async/mux_async_iterator_test.ts @@ -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 { + yield 1; + yield 2; + yield 3; +} + +// eslint-disable-next-line require-await +async function* gen456(): AsyncIterableIterator { + yield 4; + yield 5; + yield 6; +} + +Deno.test("[async] MuxAsyncIterator", async function (): Promise { + const mux = new MuxAsyncIterator(); + mux.add(gen123()); + mux.add(gen456()); + const results = new Set(); + for await (const value of mux) { + results.add(value); + } + assertEquals(results.size, 6); +}); -- cgit v1.2.3