mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 11:29:35 +00:00

common.js needs to be loaded in all tests so that there is checking for variable leaks and possibly other things. However, it does not need to be assigned to a variable if nothing in common.js is referred to elsewhere in the test. PR-URL: https://github.com/nodejs/node/pull/4408 Reviewed-By: James M Snell <jasnell@gmail.com>
34 lines
677 B
JavaScript
34 lines
677 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var assert = require('assert');
|
|
|
|
var stream = require('stream');
|
|
var PassThrough = stream.PassThrough;
|
|
|
|
var src = new PassThrough({ objectMode: true });
|
|
var tx = new PassThrough({ objectMode: true });
|
|
var dest = new PassThrough({ objectMode: true });
|
|
|
|
var expect = [ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
|
var results = [];
|
|
process.on('exit', function() {
|
|
assert.deepEqual(results, expect);
|
|
console.log('ok');
|
|
});
|
|
|
|
dest.on('data', function(x) {
|
|
results.push(x);
|
|
});
|
|
|
|
src.pipe(tx).pipe(dest);
|
|
|
|
var i = -1;
|
|
var int = setInterval(function() {
|
|
if (i > 10) {
|
|
src.end();
|
|
clearInterval(int);
|
|
} else {
|
|
src.write(i++);
|
|
}
|
|
});
|