mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
615 B
32 lines
615 B
12 years ago
|
var common = require('../common.js');
|
||
|
var R = require('_stream_readable');
|
||
|
var assert = require('assert');
|
||
|
|
||
|
var util = require('util');
|
||
|
var EE = require('events').EventEmitter;
|
||
|
|
||
|
var ondataCalled = 0;
|
||
|
|
||
|
function TestReader() {
|
||
|
R.apply(this);
|
||
|
this._buffer = new Buffer(100);
|
||
|
this._buffer.fill('x');
|
||
|
|
||
|
this.on('data', function() {
|
||
|
ondataCalled++;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
util.inherits(TestReader, R);
|
||
|
|
||
12 years ago
|
TestReader.prototype._read = function(n) {
|
||
|
this.push(this._buffer);
|
||
12 years ago
|
this._buffer = new Buffer(0);
|
||
|
};
|
||
|
|
||
|
var reader = new TestReader();
|
||
12 years ago
|
setImmediate(function() {
|
||
|
assert.equal(ondataCalled, 1);
|
||
|
console.log('ok');
|
||
|
});
|