mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
f29762f4dd
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
38 lines
721 B
JavaScript
38 lines
721 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var R = require('_stream_readable');
|
|
var W = require('_stream_writable');
|
|
var assert = require('assert');
|
|
|
|
var src = new R({encoding: 'base64'});
|
|
var dst = new W();
|
|
var hasRead = false;
|
|
var accum = [];
|
|
var timeout;
|
|
|
|
src._read = function(n) {
|
|
if(!hasRead) {
|
|
hasRead = true;
|
|
process.nextTick(function() {
|
|
src.push(new Buffer('1'));
|
|
src.push(null);
|
|
});
|
|
};
|
|
};
|
|
|
|
dst._write = function(chunk, enc, cb) {
|
|
accum.push(chunk);
|
|
cb();
|
|
};
|
|
|
|
src.on('end', function() {
|
|
assert.equal(Buffer.concat(accum) + '', 'MQ==');
|
|
clearTimeout(timeout);
|
|
});
|
|
|
|
src.pipe(dst);
|
|
|
|
timeout = setTimeout(function() {
|
|
assert.fail('timed out waiting for _write');
|
|
}, 100);
|