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: nodejs#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 committed Nov 12, 2018
1 parent 981701b commit d6f52f5
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 d6f52f5

Please sign in to comment.