11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst { Writable } = require('stream');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci{
71cb0ef41Sopenharmony_ci  const w = new Writable({
81cb0ef41Sopenharmony_ci    write: common.mustCall((chunk, encoding, cb) => {
91cb0ef41Sopenharmony_ci      w.on('close', common.mustCall(() => {
101cb0ef41Sopenharmony_ci        cb();
111cb0ef41Sopenharmony_ci      }));
121cb0ef41Sopenharmony_ci    })
131cb0ef41Sopenharmony_ci  });
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci  w.on('finish', common.mustNotCall());
161cb0ef41Sopenharmony_ci  w.end('asd');
171cb0ef41Sopenharmony_ci  w.destroy();
181cb0ef41Sopenharmony_ci}
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci{
211cb0ef41Sopenharmony_ci  const w = new Writable({
221cb0ef41Sopenharmony_ci    write: common.mustCall((chunk, encoding, cb) => {
231cb0ef41Sopenharmony_ci      w.on('close', common.mustCall(() => {
241cb0ef41Sopenharmony_ci        cb();
251cb0ef41Sopenharmony_ci        w.end();
261cb0ef41Sopenharmony_ci      }));
271cb0ef41Sopenharmony_ci    })
281cb0ef41Sopenharmony_ci  });
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci  w.on('finish', common.mustNotCall());
311cb0ef41Sopenharmony_ci  w.write('asd');
321cb0ef41Sopenharmony_ci  w.destroy();
331cb0ef41Sopenharmony_ci}
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci{
361cb0ef41Sopenharmony_ci  const w = new Writable({
371cb0ef41Sopenharmony_ci    write() {
381cb0ef41Sopenharmony_ci    }
391cb0ef41Sopenharmony_ci  });
401cb0ef41Sopenharmony_ci  w.on('finish', common.mustNotCall());
411cb0ef41Sopenharmony_ci  w.end();
421cb0ef41Sopenharmony_ci  w.destroy();
431cb0ef41Sopenharmony_ci}
44