Streams: add test for _readableState.readingMore | #8685#9868
Streams: add test for _readableState.readingMore | #8685#9868chmln wants to merge 10 commits intonodejs:masterfrom chmln:test-readable-readingMore
Conversation
|
cc: @mcollina |
| @@ -0,0 +1,31 @@ | |||
| 'use strict'; | |||
| const Readable = require('stream').Readable, | |||
There was a problem hiding this comment.
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.
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.
Please capitalize and punctuate comments.
| // false initially | ||
| assert.strictEqual(readable._readableState.readingMore, false); | ||
|
|
||
| readable.on('data', data => { |
There was a problem hiding this comment.
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.
Same comment about common.mustCall() here.
| }); | ||
|
|
||
|
|
||
| readable.push("abc"); |
There was a problem hiding this comment.
Please use single quotes for strings.
|
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 |
|
Landed 8621ccc Thanks for the contribution. |
#8685
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
stream
Description of change
Test cases for
stream.Readable._readableState.readingandreadingMoreproperties are tested on initialization, underdata,readable, andendevents.