Skip to content
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

Closed
wants to merge 10 commits into from
Closed

Streams: add test for _readableState.readingMore | #8685 #9868

wants to merge 10 commits into from

Conversation

chmln
Copy link
Contributor

@chmln chmln commented Dec 1, 2016

#8685

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

Description of change

Test cases for stream.Readable._readableState.
reading and readingMore properties are tested on initialization, under data, readable, and end events.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@mscdex mscdex added the stream Issues and PRs related to the stream subsystem. label Dec 1, 2016
@italoacasas
Copy link
Contributor

cc: @mcollina

@@ -0,0 +1,31 @@
'use strict';
const Readable = require('stream').Readable,
Copy link
Contributor

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');
Copy link
Contributor

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
Copy link
Contributor

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 => {
Copy link
Contributor

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', () => {
Copy link
Contributor

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");
Copy link
Contributor

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.

Copy link
Contributor Author

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 👍

@mcollina
Copy link
Member

mcollina commented Dec 1, 2016

We need to have an equivalent for readable as well, would you mind adding it, or renaming the test file to test/parallel/test-stream-readable-readingMore-ondata.js?

@chmln
Copy link
Contributor Author

chmln commented Dec 1, 2016

We need to have an equivalent for readable as well, would you mind adding it,

Absolutely.

@mcollina
Copy link
Member

mcollina commented Dec 7, 2016

@chmln keep it coming :). The current test looks good, I'll wait for the one on the 'readable' event too!

@mcollina
Copy link
Member

mcollina commented Dec 9, 2016

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@italoacasas
Copy link
Contributor

Landed 8621ccc

Thanks for the contribution.

italoacasas pushed a commit that referenced this pull request Dec 11, 2016
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
This was referenced Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
PR-URL: #9868
Refs: #8685
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants