11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst { Readable } = require('stream'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// This test verifies that a stream could be resumed after 81cb0ef41Sopenharmony_ci// removing the readable event in the same tick 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cicheck(new Readable({ 111cb0ef41Sopenharmony_ci objectMode: true, 121cb0ef41Sopenharmony_ci highWaterMark: 1, 131cb0ef41Sopenharmony_ci read() { 141cb0ef41Sopenharmony_ci if (!this.first) { 151cb0ef41Sopenharmony_ci this.push('hello'); 161cb0ef41Sopenharmony_ci this.first = true; 171cb0ef41Sopenharmony_ci return; 181cb0ef41Sopenharmony_ci } 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci this.push(null); 211cb0ef41Sopenharmony_ci } 221cb0ef41Sopenharmony_ci})); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_cifunction check(s) { 251cb0ef41Sopenharmony_ci const readableListener = common.mustNotCall(); 261cb0ef41Sopenharmony_ci s.on('readable', readableListener); 271cb0ef41Sopenharmony_ci s.on('end', common.mustCall()); 281cb0ef41Sopenharmony_ci assert.strictEqual(s.removeListener, s.off); 291cb0ef41Sopenharmony_ci s.removeListener('readable', readableListener); 301cb0ef41Sopenharmony_ci s.resume(); 311cb0ef41Sopenharmony_ci} 32