mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +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>
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
var fs = require('fs');
|
|
var util = require('util');
|
|
var path = require('path');
|
|
var fn = path.join(common.fixturesDir, 'elipses.txt');
|
|
|
|
var expected = fs.readFileSync(fn, 'utf8');
|
|
|
|
var server = net.createServer(function(stream) {
|
|
common.error('pump!');
|
|
util.pump(fs.createReadStream(fn), stream, function() {
|
|
common.error('server stream close');
|
|
common.error('server close');
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var conn = net.createConnection(common.PORT);
|
|
conn.setEncoding('utf8');
|
|
conn.on('data', function(chunk) {
|
|
common.error('recv data! nchars = ' + chunk.length);
|
|
buffer += chunk;
|
|
});
|
|
|
|
conn.on('end', function() {
|
|
conn.end();
|
|
});
|
|
conn.on('close', function() {
|
|
common.error('client connection close');
|
|
});
|
|
});
|
|
|
|
var buffer = '';
|
|
var count = 0;
|
|
|
|
server.on('listening', function() {
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(expected, buffer);
|
|
});
|