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 2018-11-06 20:42:37 +09:00
parent 981701b809
commit d6f52f5a38

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);
}