diff options
author | Matteo Collina <hello@matteocollina.com> | 2018-10-26 12:24:16 +0200 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2018-10-28 15:01:58 +0100 |
commit | 398418dd2619a2853b4a8b252db90fdf4cb60f7c (patch) | |
tree | 8824cd6b592180f552b0a17df73c2b88f32e3a91 /test/parallel/test-stream-readable-async-iterators.js | |
parent | 124d91667abb203098baa7d6cf6011e8df5eeeff (diff) | |
download | android-node-v8-398418dd2619a2853b4a8b252db90fdf4cb60f7c.tar.gz android-node-v8-398418dd2619a2853b4a8b252db90fdf4cb60f7c.tar.bz2 android-node-v8-398418dd2619a2853b4a8b252db90fdf4cb60f7c.zip |
stream: ended streams should resolve the async iteration
Fixes: https://github.com/nodejs/node/issues/23891
PR-URL: https://github.com/nodejs/node/pull/23901
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-stream-readable-async-iterators.js')
-rw-r--r-- | test/parallel/test-stream-readable-async-iterators.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index ec558955c6..a9431fab81 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -362,6 +362,24 @@ async function tests() { assert.strictEqual(e, err); } })(); + + await (async () => { + console.log('iterating on an ended stream completes'); + const r = new Readable({ + objectMode: true, + read() { + this.push('asdf'); + this.push('hehe'); + this.push(null); + } + }); + // eslint-disable-next-line no-unused-vars + for await (const a of r) { + } + // eslint-disable-next-line no-unused-vars + for await (const b of r) { + } + })(); } // to avoid missing some tests if a promise does not resolve |