Skip to content

Commit

Permalink
test: async iterate destroyed stream
Browse files Browse the repository at this point in the history
PR-URL: #28995
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
ronag committed Feb 14, 2020
1 parent 0c7ff7f commit df1592d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/parallel/test-stream-readable-async-iterators.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ async function tests() {
assert.strictEqual(received, 1);
}

{
console.log('destroyed will not deadlock');
const readable = new Readable();
readable.destroy();
process.nextTick(async () => {
readable.on('close', common.mustNotCall());
let received = 0;
for await (const k of readable) {
// Just make linting pass. This should never run.
assert.strictEqual(k, 'hello');
received++;
}
assert.strictEqual(received, 0);
});
}

{
console.log('push async');
const max = 42;
Expand Down

0 comments on commit df1592d

Please sign in to comment.