Permalink
Browse files

Stream should be empty after ended

  • Loading branch information...
1 parent 314de7b commit 80c9efd4d024a6046cdaabac0a4f57449285d3b0 @mjackson committed Oct 16, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 buffered-stream.js
  2. +4 −0 test/buffered-stream-test.js
View
@@ -52,7 +52,7 @@ util.inherits(BufferedStream, Stream);
* A read-only property that returns true if this stream has no data to emit.
*/
BufferedStream.prototype.__defineGetter__('empty', function () {
- return this._buffer && this._buffer.length === 0;
+ return !this._buffer || this._buffer.length === 0;
});
/**
@@ -51,6 +51,10 @@ describe('A BufferedStream', function () {
var stream = new BufferedStream;
stream.end();
+ it('is empty', function () {
+ assert.ok(stream.empty);
+ });
+
it('is ended', function () {
assert.ok(stream.ended);
});

0 comments on commit 80c9efd

Please sign in to comment.