mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 09:02:40 +00:00

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>
43 lines
936 B
JavaScript
43 lines
936 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
|
|
var serverGotEnd = false;
|
|
var clientGotEnd = false;
|
|
|
|
var server = net.createServer({allowHalfOpen: true}, function(socket) {
|
|
socket.resume();
|
|
socket.on('end', function() {
|
|
serverGotEnd = true;
|
|
});
|
|
socket.end();
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var client = net.connect({
|
|
host: '127.0.0.1',
|
|
port: common.PORT,
|
|
allowHalfOpen: true
|
|
}, function() {
|
|
console.error('client connect cb');
|
|
client.resume();
|
|
client.on('end', function() {
|
|
clientGotEnd = true;
|
|
setTimeout(function() {
|
|
assert(client.writable);
|
|
client.end();
|
|
}, 10);
|
|
});
|
|
client.on('close', function() {
|
|
server.close();
|
|
});
|
|
});
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
console.error('exit', serverGotEnd, clientGotEnd);
|
|
assert(serverGotEnd);
|
|
assert(clientGotEnd);
|
|
});
|