select: Make promise cancellable.

This commit is contained in:
David Braun 2017-10-15 13:32:40 -04:00
parent 03ebfaf7ab
commit 67012b6f4b
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF
3 changed files with 36 additions and 23 deletions

View file

@ -118,6 +118,13 @@ describe(`Channel`, function () {
break
}
})
it(`cancel`, async function () {
const channel = Channel()
Channel.select(channel.push(`cancelled`)).cancel()
const closed = Channel.of()
assert.equal(await Channel.select(channel.shift(), closed.shift()), closed)
})
})
describe(`functional interface`, async function () {