test: add test for autoDestroy in stream

PR-URL: https://github.com/nodejs/node/pull/24127
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
This commit is contained in:
Daijiro Wachi authored and Ruben Bridgewater committed 2018-11-14 00:55:50 +01:00
1 parent 02e9fa01f3
commit fe7ef1ad11
1 file changed
+28
+28
View File
@@ -82,3 +82,31 @@ const assert = require('assert');
assert(finished);
}));
}
{
const r = new stream.Readable({
read() {
r2.emit('error', new Error('fail'));
}
});
const r2 = new stream.Readable({
autoDestroy: true,
destroy: common.mustCall((err, cb) => cb())
});
r.pipe(r2);
}
{
const r = new stream.Readable({
read() {
w.emit('error', new Error('fail'));
}
});
const w = new stream.Writable({
autoDestroy: true,
destroy: common.mustCall((err, cb) => cb())
});
r.pipe(w);
}