forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a helper util used to determine whether a stream has been disturbed (read or cancelled). Refs: nodejs#39627 PR-URL: nodejs#39628 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
8 changed files
with
169 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const { Readable } = require('stream'); | ||
|
||
{ | ||
const readable = new Readable({ | ||
read() { | ||
} | ||
}); | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.destroy(); | ||
assert.strictEqual(readable.readableAborted, true); | ||
} | ||
|
||
{ | ||
const readable = new Readable({ | ||
read() { | ||
} | ||
}); | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.push(null); | ||
readable.destroy(); | ||
assert.strictEqual(readable.readableAborted, true); | ||
} | ||
|
||
{ | ||
const readable = new Readable({ | ||
read() { | ||
} | ||
}); | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.push('asd'); | ||
readable.destroy(); | ||
assert.strictEqual(readable.readableAborted, true); | ||
} | ||
|
||
{ | ||
const readable = new Readable({ | ||
read() { | ||
} | ||
}); | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.push('asd'); | ||
readable.push(null); | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.on('end', common.mustCall(() => { | ||
assert.strictEqual(readable.readableAborted, false); | ||
readable.destroy(); | ||
assert.strictEqual(readable.readableAborted, false); | ||
queueMicrotask(() => { | ||
assert.strictEqual(readable.readableAborted, false); | ||
}); | ||
})); | ||
readable.resume(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters