11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst { Readable, Duplex } = require('stream'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci{ 81cb0ef41Sopenharmony_ci const readable = new Readable({ 91cb0ef41Sopenharmony_ci read() { 101cb0ef41Sopenharmony_ci } 111cb0ef41Sopenharmony_ci }); 121cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 131cb0ef41Sopenharmony_ci readable.destroy(); 141cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, true); 151cb0ef41Sopenharmony_ci} 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci{ 181cb0ef41Sopenharmony_ci const readable = new Readable({ 191cb0ef41Sopenharmony_ci read() { 201cb0ef41Sopenharmony_ci } 211cb0ef41Sopenharmony_ci }); 221cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 231cb0ef41Sopenharmony_ci readable.push(null); 241cb0ef41Sopenharmony_ci readable.destroy(); 251cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, true); 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci{ 291cb0ef41Sopenharmony_ci const readable = new Readable({ 301cb0ef41Sopenharmony_ci read() { 311cb0ef41Sopenharmony_ci } 321cb0ef41Sopenharmony_ci }); 331cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 341cb0ef41Sopenharmony_ci readable.push('asd'); 351cb0ef41Sopenharmony_ci readable.destroy(); 361cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, true); 371cb0ef41Sopenharmony_ci} 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci{ 401cb0ef41Sopenharmony_ci const readable = new Readable({ 411cb0ef41Sopenharmony_ci read() { 421cb0ef41Sopenharmony_ci } 431cb0ef41Sopenharmony_ci }); 441cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 451cb0ef41Sopenharmony_ci readable.push('asd'); 461cb0ef41Sopenharmony_ci readable.push(null); 471cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 481cb0ef41Sopenharmony_ci readable.on('end', common.mustCall(() => { 491cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 501cb0ef41Sopenharmony_ci readable.destroy(); 511cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 521cb0ef41Sopenharmony_ci queueMicrotask(() => { 531cb0ef41Sopenharmony_ci assert.strictEqual(readable.readableAborted, false); 541cb0ef41Sopenharmony_ci }); 551cb0ef41Sopenharmony_ci })); 561cb0ef41Sopenharmony_ci readable.resume(); 571cb0ef41Sopenharmony_ci} 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ci{ 601cb0ef41Sopenharmony_ci const duplex = new Duplex({ 611cb0ef41Sopenharmony_ci readable: false, 621cb0ef41Sopenharmony_ci write() {} 631cb0ef41Sopenharmony_ci }); 641cb0ef41Sopenharmony_ci duplex.destroy(); 651cb0ef41Sopenharmony_ci assert.strictEqual(duplex.readableAborted, false); 661cb0ef41Sopenharmony_ci} 67