11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst stream = require('stream'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst writable = new stream.Writable(); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciwritable._write = (chunk, encoding, cb) => { 111cb0ef41Sopenharmony_ci // The state finished should start in false. 121cb0ef41Sopenharmony_ci assert.strictEqual(writable._writableState.finished, false); 131cb0ef41Sopenharmony_ci cb(); 141cb0ef41Sopenharmony_ci}; 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciwritable.on('finish', common.mustCall(() => { 171cb0ef41Sopenharmony_ci assert.strictEqual(writable._writableState.finished, true); 181cb0ef41Sopenharmony_ci})); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciwritable.end('testing finished state', common.mustCall(() => { 211cb0ef41Sopenharmony_ci assert.strictEqual(writable._writableState.finished, true); 221cb0ef41Sopenharmony_ci})); 23