mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 18:29:01 +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>
38 lines
939 B
JavaScript
38 lines
939 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var http = require('http');
|
|
|
|
var invalidLocalAddress = '1.2.3.4';
|
|
var gotError = false;
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
console.log('Connect from: ' + req.connection.remoteAddress);
|
|
|
|
req.on('end', function() {
|
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
res.end('You are from: ' + req.connection.remoteAddress);
|
|
});
|
|
req.resume();
|
|
});
|
|
|
|
server.listen(common.PORT, '127.0.0.1', function() {
|
|
var req = http.request({
|
|
host: 'localhost',
|
|
port: common.PORT,
|
|
path: '/',
|
|
method: 'GET',
|
|
localAddress: invalidLocalAddress
|
|
}, function(res) {
|
|
assert.fail('unexpectedly got response from server');
|
|
}).on('error', function(e) {
|
|
console.log('client got error: ' + e.message);
|
|
gotError = true;
|
|
server.close();
|
|
}).end();
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(gotError);
|
|
});
|