Simplify implementation of select.

This commit is contained in:
David Braun 2019-03-20 11:09:26 -04:00
parent ea2cc74711
commit 3ff3031b1e
No known key found for this signature in database
GPG key ID: 87EC41ADF710B7E2
2 changed files with 37 additions and 37 deletions

View file

@ -98,6 +98,7 @@ describe(`Channel function`, function() {
it(`miscellaneous`, async function() {
const a = Channel();
const b = Channel();
(async () => {
await b.push(0);
await a.push(1);
@ -114,10 +115,9 @@ describe(`Channel function`, function() {
it(`allows for non-blocking selects`, async function() {
const a = Channel();
const b = Channel();
const closed = Channel.of();
switch (
await Channel.select([a.shift(), b.push(0), Channel.of().shift()])
) {
switch (await Channel.select([a.shift(), b.push(0), closed.shift()])) {
case a:
assert(false);
break;