mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
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:
1 parent
02e9fa01f3
commit
fe7ef1ad11
1 file changed
+28
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user