Skip to content

Commit

Permalink
test: add test for autoDestroy in stream
Browse files Browse the repository at this point in the history
PR-URL: #24127
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
  • Loading branch information
watilde authored and BridgeAR committed Nov 13, 2018
1 parent 02e9fa0 commit fe7ef1a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/parallel/test-stream-auto-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit fe7ef1a

Please sign in to comment.