summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-pipe-unpipe-streams.js
diff options
context:
space:
mode:
authorWeijia Wang <starkwang@126.com>2019-07-11 23:14:49 +0800
committerAnna Henningsen <anna@addaleax.net>2019-07-15 00:19:51 +0200
commit824dc576db6399195298206270ce5f446ee34359 (patch)
tree1531803cc630db37949366c87c7b3fbc523daaa1 /test/parallel/test-stream-pipe-unpipe-streams.js
parent5bed327a34625e7e60ac67970771556093a3d7bf (diff)
downloadandroid-node-v8-824dc576db6399195298206270ce5f446ee34359.tar.gz
android-node-v8-824dc576db6399195298206270ce5f446ee34359.tar.bz2
android-node-v8-824dc576db6399195298206270ce5f446ee34359.zip
stream: simplify `.pipe()` and `.unpipe()` in Readable
Now we are using `pipes` and `pipesCount` in Readable state and the `pipes` value can be a stream or an array of streams. This change reducing them into one `pipes` value, which is an array of streams. PR-URL: https://github.com/nodejs/node/pull/28583 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-stream-pipe-unpipe-streams.js')
-rw-r--r--test/parallel/test-stream-pipe-unpipe-streams.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js
index c8a383bc61..4cb8413af2 100644
--- a/test/parallel/test-stream-pipe-unpipe-streams.js
+++ b/test/parallel/test-stream-pipe-unpipe-streams.js
@@ -22,7 +22,7 @@ assert.strictEqual(source._readableState.pipes.length, 2);
source.unpipe(dest2);
-assert.strictEqual(source._readableState.pipes, dest1);
+assert.deepStrictEqual(source._readableState.pipes, [dest1]);
assert.notStrictEqual(source._readableState.pipes, dest2);
dest2.on('unpipe', common.mustNotCall());
@@ -30,7 +30,7 @@ source.unpipe(dest2);
source.unpipe(dest1);
-assert.strictEqual(source._readableState.pipes, null);
+assert.strictEqual(source._readableState.pipes.length, 0);
{
// Test `cleanup()` if we unpipe all streams.
@@ -43,8 +43,7 @@ assert.strictEqual(source._readableState.pipes, null);
const destCheckEventNames = ['close', 'finish', 'drain', 'error', 'unpipe'];
const checkSrcCleanup = common.mustCall(() => {
- assert.strictEqual(source._readableState.pipes, null);
- assert.strictEqual(source._readableState.pipesCount, 0);
+ assert.strictEqual(source._readableState.pipes.length, 0);
assert.strictEqual(source._readableState.flowing, false);
srcCheckEventNames.forEach((eventName) => {