2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2015-12-23 16:02:12 -08:00
|
|
|
require('../common');
|
2016-12-30 18:38:06 -05:00
|
|
|
const assert = require('assert');
|
2015-02-03 01:12:41 +00:00
|
|
|
|
2016-12-30 18:38:06 -05:00
|
|
|
const Transform = require('stream').Transform;
|
2015-02-03 01:12:41 +00:00
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
let _transformCalled = false;
|
2015-02-03 01:12:41 +00:00
|
|
|
function _transform(d, e, n) {
|
|
|
|
_transformCalled = true;
|
|
|
|
n();
|
|
|
|
}
|
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
let _flushCalled = false;
|
2015-02-03 01:12:41 +00:00
|
|
|
function _flush(n) {
|
|
|
|
_flushCalled = true;
|
|
|
|
n();
|
|
|
|
}
|
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const t = new Transform({
|
2015-02-03 01:12:41 +00:00
|
|
|
transform: _transform,
|
|
|
|
flush: _flush
|
|
|
|
});
|
|
|
|
|
2016-01-25 15:00:06 -08:00
|
|
|
t.end(Buffer.from('blerg'));
|
2015-02-03 01:12:41 +00:00
|
|
|
t.resume();
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
process.on('exit', function() {
|
2017-01-08 15:36:25 +00:00
|
|
|
assert.strictEqual(t._transform, _transform);
|
|
|
|
assert.strictEqual(t._flush, _flush);
|
2015-02-03 01:12:41 +00:00
|
|
|
assert(_transformCalled);
|
|
|
|
assert(_flushCalled);
|
|
|
|
});
|