-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Streams: add test for _readableState.readingMore | #8685 #9868
Conversation
cc: @mcollina |
@@ -0,0 +1,31 @@ | |||
'use strict'; | |||
const Readable = require('stream').Readable, |
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.
@@ -0,0 +1,31 @@ | |||
'use strict'; | |||
const Readable = require('stream').Readable, | |||
assert = require('assert'); |
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 use a new const
statement on each line (drop the comma separated declarations).
assert.strictEqual(readable._readableState.readingMore, false); | ||
|
||
readable.on('data', data => { | ||
// still in a flowing state, try to read more |
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 capitalize and punctuate comments.
// false initially | ||
assert.strictEqual(readable._readableState.readingMore, false); | ||
|
||
readable.on('data', data => { |
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.
Since there are assertions inside of this callback, can you wrap it in common.mustCall()
.
assert.strictEqual(readable._readableState.readingMore, true); | ||
}); | ||
|
||
readable.on('end', () => { |
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.
Same comment about common.mustCall()
here.
}); | ||
|
||
|
||
readable.push("abc"); |
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 use single quotes for strings.
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.
@cjihrig Thank you for the guidance 👍
We need to have an equivalent for |
Absolutely. |
@chmln keep it coming :). The current test looks good, I'll wait for the one on the |
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.
LGTM
Landed 8621ccc Thanks for the contribution. |
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
#8685
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
stream
Description of change
Test cases for
stream.Readable._readableState
.reading
andreadingMore
properties are tested on initialization, underdata
,readable
, andend
events.