mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 09:09:51 +00:00

PR-URL: https://github.com/nodejs/node/pull/40852 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
44 lines
715 B
JavaScript
44 lines
715 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { Writable } = require('stream');
|
|
|
|
{
|
|
const w = new Writable({
|
|
write: common.mustCall((chunk, encoding, cb) => {
|
|
w.on('close', common.mustCall(() => {
|
|
cb();
|
|
}));
|
|
})
|
|
});
|
|
|
|
w.on('finish', common.mustNotCall());
|
|
w.end('asd');
|
|
w.destroy();
|
|
}
|
|
|
|
{
|
|
const w = new Writable({
|
|
write: common.mustCall((chunk, encoding, cb) => {
|
|
w.on('close', common.mustCall(() => {
|
|
cb();
|
|
w.end();
|
|
}));
|
|
})
|
|
});
|
|
|
|
w.on('finish', common.mustNotCall());
|
|
w.write('asd');
|
|
w.destroy();
|
|
}
|
|
|
|
{
|
|
const w = new Writable({
|
|
write() {
|
|
}
|
|
});
|
|
w.on('finish', common.mustNotCall());
|
|
w.end();
|
|
w.destroy();
|
|
}
|