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

test: add tests for a some stream.Readable use cases #7260

Merged
merged 1 commit into from
Jun 18, 2016

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Jun 10, 2016

Checklist
  • make -j4 test (UNIX) or vcbuild test nosign (Windows) passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Adds tests for a couple of stream.Readable use cases that were previously not covered by tests.

/cc @nodejs/streams

CI: https://ci.nodejs.org/job/node-test-commit/3709/

@addaleax addaleax added stream Issues and PRs related to the stream subsystem. test Issues and PRs related to the tests. labels Jun 10, 2016
@mcollina
Copy link
Member

Thx @addaleax, these are much needed!

Would you mind adding the equivalent of test/parallel/test-stream-readable-invalid-chunk.js
for objectMode streams?

for (const target of writables) {
assert.deepStrictEqual(target.output, [input]);
}
});
Copy link
Member

Choose a reason for hiding this comment

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

why on('exit')? I would prefer having those when the streams ends. I think it's cleaner to read.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mcollina Updated with readable.on('end')

@addaleax
Copy link
Member Author

@mcollina In chunkInvalid() there’s an explicit test for !state.objectMode, so… what exactly would an invalid chunk in object mode look like?

@mcollina
Copy link
Member

@addaleax quite true :), forget my comment (not enough coffee this morning).

readable.unpipe(target);
}

readable.push('something else'); // This does not get through.
Copy link
Member

Choose a reason for hiding this comment

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

there are probably some extra spaces here

Copy link
Member Author

Choose a reason for hiding this comment

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

@mcollina Fixed (if you’re talking about the spaces before the comment)

@mcollina
Copy link
Member

LGTM

@calvinmetcalf
Copy link
Contributor

should we squash this or leave them as 4 separate commits as they do 4 separate things, my gut says leave them be but I'm not sure @Fishrock123 opinion ?

@addaleax
Copy link
Member Author

I don’t care a lot about squashing these or not. When landing other PRs, I usually go by something like “bisectable logical units”, so I’d probably leave them as they are unless somebody objects to that.

@addaleax
Copy link
Member Author

Rebased against the current master, one more CI just to be sure: https://ci.nodejs.org/job/node-test-commit/3759/

@mcollina
Copy link
Member

We usually squash to edit/reconstruct the metadata easily.

* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: nodejs#7260
Reviewed-By: Matteo Collina <[email protected]>
@addaleax addaleax merged commit 3fe3b41 into nodejs:master Jun 18, 2016
evanlucas pushed a commit that referenced this pull request Jun 27, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
@Fishrock123 Fishrock123 mentioned this pull request Jun 27, 2016
@Fishrock123 Fishrock123 mentioned this pull request Jul 5, 2016
MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
* test: check invalid chunk error for readable.push

  Test that passing invalid chunks to readable.push() in
  non-object mode throw errors.

* test: add simple object mode + decoder stream test

* test: add test for readable stream lacking _read

  Check that using a readable stream without a _read method will throw
  an error.

* test: add basic test for piping to multiple dests

  Add a simple test for piping and unpiping from a readable stream
  to multiple writable streams.

PR-URL: #7260
Reviewed-By: Matteo Collina <[email protected]>
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.

4 participants