diff options
author | Robert Nagy <ronagy@icloud.com> | 2019-09-08 10:35:34 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-09-22 15:55:15 -0700 |
commit | ec390b63a1989d5da0ec7043f7e2e91398212877 (patch) | |
tree | 8f133aa5366591c0d692473f0a71a02611a393a7 /test/parallel | |
parent | 8709a408d2eb31a996077cf0ea48c5fbba93adae (diff) | |
download | node-new-ec390b63a1989d5da0ec7043f7e2e91398212877.tar.gz |
stream: do not call _read() after destroy()
PR-URL: https://github.com/nodejs/node/pull/29491
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'test/parallel')
-rw-r--r-- | test/parallel/test-stream-readable-destroy.js | 9 | ||||
-rw-r--r-- | test/parallel/test-wrap-js-stream-exceptions.js | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index 05e7dd464d..7687ea90cc 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -189,3 +189,12 @@ const assert = require('assert'); read.push('hi'); read.on('data', common.mustNotCall()); } + +{ + const read = new Readable({ + read: common.mustNotCall(function() {}) + }); + read.destroy(); + assert.strictEqual(read.destroyed, true); + read.read(); +} diff --git a/test/parallel/test-wrap-js-stream-exceptions.js b/test/parallel/test-wrap-js-stream-exceptions.js index cde7c17844..eeab26f525 100644 --- a/test/parallel/test-wrap-js-stream-exceptions.js +++ b/test/parallel/test-wrap-js-stream-exceptions.js @@ -10,7 +10,7 @@ process.once('uncaughtException', common.mustCall((err) => { })); const socket = new JSStreamWrap(new Duplex({ - read: common.mustCall(), + read: common.mustNotCall(), write: common.mustCall((buffer, data, cb) => { throw new Error('exception!'); }) |