mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +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>
36 lines
806 B
JavaScript
36 lines
806 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var net = require('net');
|
|
|
|
var expected_bad_connections = 1;
|
|
var actual_bad_connections = 0;
|
|
|
|
var host = '********';
|
|
host += host;
|
|
host += host;
|
|
host += host;
|
|
host += host;
|
|
host += host;
|
|
|
|
function do_not_call() {
|
|
throw new Error('This function should not have been called.');
|
|
}
|
|
|
|
var socket = net.connect(42, host, do_not_call);
|
|
socket.on('error', function(err) {
|
|
assert.equal(err.code, 'ENOTFOUND');
|
|
actual_bad_connections++;
|
|
});
|
|
socket.on('lookup', function(err, ip, type) {
|
|
assert(err instanceof Error);
|
|
assert.equal(err.code, 'ENOTFOUND');
|
|
assert.equal(ip, undefined);
|
|
assert.equal(type, undefined);
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(actual_bad_connections, expected_bad_connections);
|
|
});
|