Skip to content

Conversation

@chmln
Copy link
Contributor

@chmlnchmln 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-botnodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@mscdexmscdex added the stream Issues and PRs related to the stream subsystem. label Dec 1, 2016
@italoacasas
Copy link

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
ContributorAuthor

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

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
ContributorAuthor

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

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

@mcollina
Copy link
Member

Copy link
Member

@mcollinamcollina 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

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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
@italoacasasitaloacasas 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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
PR-URL: #9868 Refs: #8685 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streamIssues and PRs related to the stream subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@chmln@italoacasas@mcollina@cjihrig@mscdex@MylesBorins@nodejs-github-bot