11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst { Readable } = require('stream'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// readable.resume() should not lead to a ._read() call being scheduled 61cb0ef41Sopenharmony_ci// when we exceed the high water mark already. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst readable = new Readable({ 91cb0ef41Sopenharmony_ci read: common.mustNotCall(), 101cb0ef41Sopenharmony_ci highWaterMark: 100 111cb0ef41Sopenharmony_ci}); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci// Fill up the internal buffer so that we definitely exceed the HWM: 141cb0ef41Sopenharmony_cifor (let i = 0; i < 10; i++) 151cb0ef41Sopenharmony_ci readable.push('a'.repeat(200)); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci// Call resume, and pause after one chunk. 181cb0ef41Sopenharmony_ci// The .pause() is just so that we don’t empty the buffer fully, which would 191cb0ef41Sopenharmony_ci// be a valid reason to call ._read(). 201cb0ef41Sopenharmony_cireadable.resume(); 211cb0ef41Sopenharmony_cireadable.once('data', common.mustCall(() => readable.pause())); 22