summaryrefslogtreecommitdiff
path: root/cli/js/net_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/net_test.ts')
-rw-r--r--cli/js/net_test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/js/net_test.ts b/cli/js/net_test.ts
index 33f4f7d07..dc7451434 100644
--- a/cli/js/net_test.ts
+++ b/cli/js/net_test.ts
@@ -77,6 +77,18 @@ testPerm({ net: true }, async function netDialListen(): Promise<void> {
conn.close();
});
+testPerm({ net: true }, async function netListenCloseWhileIterating(): Promise<
+ void
+> {
+ const listener = Deno.listen({ port: 8000 });
+ const nextWhileClosing = listener[Symbol.asyncIterator]().next();
+ listener.close();
+ assertEquals(await nextWhileClosing, { value: undefined, done: true });
+
+ const nextAfterClosing = listener[Symbol.asyncIterator]().next();
+ assertEquals(await nextAfterClosing, { value: undefined, done: true });
+});
+
/* TODO(ry) Re-enable this test.
testPerm({ net: true }, async function netListenAsyncIterator(): Promise<void> {
const listener = Deno.listen(":4500");