Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created February 20, 2013 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/5000773 to your computer and use it in GitHub Desktop.
Save Raynos/5000773 to your computer and use it in GitHub Desktop.
test("high water mark", function (assert) {
var count = 100
var list = []
for (var i = 0; i < count; i++) {
list.push(i)
}
var s = Readable({
objectMode: true
, highWaterMark: 100
})
s._read = function () {
var bools = list.map(function (i) {
return s.push(i)
})
assert.ok(bools.every(function (x) {
return x === true
}))
var needMore = s.push(100)
// IS ACTUALLY TRUE ;_; because s.needReadable is set
// I think if push makes it go over the high water mark we should
// return false and ignore the fact we need a readable.
assert.equal(needMore, false)
// console.log("s", s._readableState)
}
s.read(0)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment