summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-readable-constructor-set-methods.js
blob: e5e3114de456db02a78eefddefe0402a444c205f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
require('../common');
const assert = require('assert');

const Readable = require('stream').Readable;

let _readCalled = false;
function _read(n) {
  _readCalled = true;
  this.push(null);
}

const r = new Readable({ read: _read });
r.resume();

process.on('exit', function() {
  assert.strictEqual(r._read, _read);
  assert(_readCalled);
});