[Pkg-javascript-commits] [node-stream-splicer] 57/71: .length
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:55:53 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-splicer.
commit 35598ca9f82557fa0f4fcccf7f5f08dd242d2ecd
Author: James Halliday <mail at substack.net>
Date: Sun Jun 15 21:42:35 2014 -0700
.length
---
index.js | 1 +
test/push.js | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index 3dc9f7d..a5e7b31 100644
--- a/index.js
+++ b/index.js
@@ -155,6 +155,7 @@ Pipeline.prototype.splice = function (start, removeLen) {
var removed = self._streams.splice.apply(self._streams, sargs);
this.emit('_mutate');
+ this.length = this._streams.length;
return removed;
};
diff --git a/test/push.js b/test/push.js
index 67759de..c3f4c08 100644
--- a/test/push.js
+++ b/test/push.js
@@ -10,7 +10,7 @@ test('push', function (t) {
expected.second = [ 6.66, 7.77 ];
expected.output = [ 3.33, 4.44, 5.55, 3, 2 ];
- t.plan(5 + 2 + 5);
+ t.plan(5 + 2 + 5 + 3);
var a = split();
var b = through.obj(function (row, enc, next) {
@@ -21,7 +21,11 @@ test('push', function (t) {
var d = through.obj(function (x, enc, next) { this.push(x * 111); next() });
var first = through.obj(function (row, enc, next) {
- if (expected.first.length === 2) p.push(second);
+ if (expected.first.length === 2) {
+ t.equal(p.length, 5);
+ p.push(second);
+ t.equal(p.length, 6);
+ }
var ex = expected.first.shift();
t.deepEqual(row, ex);
@@ -37,6 +41,8 @@ test('push', function (t) {
});
var p = pipeline.obj([ a, b, c, d, first ]);
+ t.equal(p.length, 5);
+
p.pipe(through.obj(function (row, enc, next) {
var ex = expected.output.shift();
t.deepEqual(row, ex);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-splicer.git
More information about the Pkg-javascript-commits
mailing list