-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Streams: add test for _readableState.readingMore | #8685 #9868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
19432ad
370674a
9747c04
395368e
1968956
71ebbbc
1e6428e
a655f4c
466c083
2973949
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| 'use strict'; | ||
| const Readable = require('stream').Readable, | ||
| assert = require('assert'); | ||
|
||
|
|
||
| const readable = new Readable({ | ||
| read(size) {} | ||
| }); | ||
|
|
||
| // false initially | ||
| assert.strictEqual(readable._readableState.readingMore, false); | ||
|
|
||
| readable.on('data', data => { | ||
|
||
| // still in a flowing state, try to read more | ||
|
||
| assert.strictEqual(readable._readableState.readingMore, true); | ||
| }); | ||
|
|
||
| readable.on('end', () => { | ||
|
||
| // end of stream | ||
| // reading is false, and so should be readingMore | ||
| assert.strictEqual(readable._readableState.readingMore, false); | ||
| }); | ||
|
|
||
|
|
||
| readable.push("abc"); | ||
|
||
| readable.push(null); | ||
|
|
||
| process.nextTick(() => { | ||
| // finished reading | ||
| // reading is false, and so should be readingMore | ||
| assert.strictEqual(readable._readableState.readingMore, false); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please require
../common.js, as done in other test files.