Skip to content

Commit

Permalink
test: fix style issues after eslint update
Browse files Browse the repository at this point in the history
Replace var keyword with const or let.

PR-URL: nodejs#2286
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
targos authored and Michael Scovetta committed Apr 2, 2016
1 parent df6d565 commit 289a836
Show file tree
Hide file tree
Showing 110 changed files with 948 additions and 901 deletions.
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ exports.getServiceName = function getServiceName(port, protocol) {
if (matches && matches.length > 1) {
serviceName = matches[1];
}
} catch(e) {
} catch (e) {
console.error('Cannot read file: ', etcServicesFileName);
return undefined;
}
Expand Down
4 changes: 2 additions & 2 deletions test/debugger/test-debugger-repl-break-in-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [

// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\\/]mod\.js:23/,
/21/, /22/, /23/, /24/, /25/
/break in .*[\\\/]mod\.js:23/,
/21/, /22/, /23/, /24/, /25/
]);

// -- RESTORE BREAKPOINT ON RESTART --
Expand Down
2 changes: 1 addition & 1 deletion test/debugger/test-debugger-repl-restart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var repl = require('./helper-debugger-repl.js');

repl.startDebugger('breakpoints.js');
var linesWithBreakpoint = [
/1/, /2/, /3/, /4/, /5/, /\* 6/
/1/, /2/, /3/, /4/, /5/, /\* 6/
];
// We slice here, because addTest will change the given array.
repl.addTest('sb(6)', linesWithBreakpoint.slice());
Expand Down
18 changes: 9 additions & 9 deletions test/gc/test-http-client-connaborted.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ function serverHandler(req, res) {
res.connection.destroy();
}

var http = require('http'),
weak = require('weak'),
done = 0,
count = 0,
countGC = 0,
todo = 500,
common = require('../common'),
assert = require('assert'),
PORT = common.PORT;
const http = require('http');
const weak = require('weak');
const common = require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
let countGC = 0;

console.log('We should do ' + todo + ' requests');

Expand Down
18 changes: 9 additions & 9 deletions test/gc/test-http-client-onerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ function serverHandler(req, res) {
res.end('Hello World\n');
}

var http = require('http'),
weak = require('weak'),
done = 0,
count = 0,
countGC = 0,
todo = 500,
common = require('../common'),
assert = require('assert'),
PORT = common.PORT;
const http = require('http');
const weak = require('weak');
const common = require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
let countGC = 0;

console.log('We should do ' + todo + ' requests');

Expand Down
18 changes: 9 additions & 9 deletions test/gc/test-http-client-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ function serverHandler(req, res) {
}, 100);
}

var http = require('http'),
weak = require('weak'),
done = 0,
count = 0,
countGC = 0,
todo = 550,
common = require('../common'),
assert = require('assert'),
PORT = common.PORT;
const http = require('http');
const weak = require('weak');
const common = require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 550;
let done = 0;
let count = 0;
let countGC = 0;

console.log('We should do ' + todo + ' requests');

Expand Down
18 changes: 9 additions & 9 deletions test/gc/test-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ function serverHandler(req, res) {
res.end('Hello World\n');
}

var http = require('http'),
weak = require('weak'),
done = 0,
count = 0,
countGC = 0,
todo = 500,
common = require('../common'),
assert = require('assert'),
PORT = common.PORT;
const http = require('http');
const weak = require('weak');
const common = require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
let countGC = 0;

console.log('We should do ' + todo + ' requests');

Expand Down
18 changes: 9 additions & 9 deletions test/gc/test-net-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ function serverHandler(sock) {
}, 100);
}

var net = require('net'),
weak = require('weak'),
done = 0,
count = 0,
countGC = 0,
todo = 500,
common = require('../common'),
assert = require('assert'),
PORT = common.PORT;
const net = require('net');
const weak = require('weak');
const common = require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
let countGC = 0;

console.log('We should do ' + todo + ' requests');

Expand Down
68 changes: 37 additions & 31 deletions test/internet/test-dgram-broadcast-multi-process.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';
var common = require('../common'),
assert = require('assert'),
dgram = require('dgram'),
util = require('util'),
networkInterfaces = require('os').networkInterfaces(),
Buffer = require('buffer').Buffer,
fork = require('child_process').fork,
LOCAL_BROADCAST_HOST = '255.255.255.255',
TIMEOUT = common.platformTimeout(5000),
messages = [
new Buffer('First message to send'),
new Buffer('Second message to send'),
new Buffer('Third message to send'),
new Buffer('Fourth message to send')
];
const common = require('../common');
const assert = require('assert');
const dgram = require('dgram');
const util = require('util');
const networkInterfaces = require('os').networkInterfaces();
const Buffer = require('buffer').Buffer;
const fork = require('child_process').fork;
const LOCAL_BROADCAST_HOST = '255.255.255.255';
const TIMEOUT = common.platformTimeout(5000);
const messages = [
new Buffer('First message to send'),
new Buffer('Second message to send'),
new Buffer('Third message to send'),
new Buffer('Fourth message to send')
];

if (common.inFreeBSDJail) {
console.log('1..0 # Skipped: in a FreeBSD jail');
Expand All @@ -34,13 +34,13 @@ get_bindAddress: for (var name in networkInterfaces) {
assert.ok(bindAddress);

if (process.argv[2] !== 'child') {
var workers = {},
listeners = 3,
listening = 0,
dead = 0,
i = 0,
done = 0,
timer = null;
const workers = {};
const listeners = 3;
let listening = 0;
let dead = 0;
let i = 0;
let done = 0;
let timer = null;

//exit the test if it doesn't succeed within TIMEOUT
timer = setTimeout(function() {
Expand Down Expand Up @@ -166,15 +166,21 @@ if (process.argv[2] !== 'child') {
return;
}

sendSocket.send(buf, 0, buf.length,
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
if (err) throw err;
console.error('[PARENT] sent %s to %s:%s',
util.inspect(buf.toString()),
LOCAL_BROADCAST_HOST, common.PORT);

process.nextTick(sendSocket.sendNext);
});
sendSocket.send(
buf,
0,
buf.length,
common.PORT,
LOCAL_BROADCAST_HOST,
function(err) {
if (err) throw err;
console.error('[PARENT] sent %s to %s:%s',
util.inspect(buf.toString()),
LOCAL_BROADCAST_HOST, common.PORT);

process.nextTick(sendSocket.sendNext);
}
);
};

function killChildren(children) {
Expand Down
22 changes: 14 additions & 8 deletions test/internet/test-dgram-multicast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,20 @@ if (process.argv[2] !== 'child') {
return;
}

sendSocket.send(buf, 0, buf.length,
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
if (err) throw err;
console.error('[PARENT] sent "%s" to %s:%s',
buf.toString(),
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
});
sendSocket.send(
buf,
0,
buf.length,
common.PORT,
LOCAL_BROADCAST_HOST,
function(err) {
if (err) throw err;
console.error('[PARENT] sent "%s" to %s:%s',
buf.toString(),
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
}
);
};
}

Expand Down
47 changes: 25 additions & 22 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';
var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIPv4 = net.isIPv4;
const common = require('../common');
const assert = require('assert');
const dns = require('dns');
const net = require('net');
const isIPv4 = net.isIPv4;

var expected = 0,
completed = 0,
running = false,
queue = [];
let expected = 0;
let completed = 0;
let running = false;
const queue = [];

function TEST(f) {
function next() {
Expand Down Expand Up @@ -148,19 +148,22 @@ TEST(function test_lookup_localhost_ipv4(done) {
});

TEST(function test_lookup_all_ipv4(done) {
var req = dns.lookup('www.google.com', {all: true, family: 4},
function(err, ips) {
if (err) throw err;
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);

ips.forEach(function(ip) {
assert.ok(isIPv4(ip.address));
assert.strictEqual(ip.family, 4);
});

done();
});
var req = dns.lookup(
'www.google.com',
{all: true, family: 4},
function(err, ips) {
if (err) throw err;
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);

ips.forEach(function(ip) {
assert.ok(isIPv4(ip.address));
assert.strictEqual(ip.family, 4);
});

done();
}
);

checkWrap(req);
});
Expand Down
49 changes: 26 additions & 23 deletions test/internet/test-dns-ipv6.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';
var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIPv6 = net.isIPv6;
const common = require('../common');
const assert = require('assert');
const dns = require('dns');
const net = require('net');
const isIPv6 = net.isIPv6;

var expected = 0,
completed = 0,
running = false,
queue = [];
let expected = 0;
let completed = 0;
let running = false;
const queue = [];

if (!common.hasIPv6) {
console.log('1..0 # Skipped: this test, no IPv6 support');
Expand Down Expand Up @@ -156,20 +156,23 @@ TEST(function test_lookup_ip_ipv6(done) {
});

TEST(function test_lookup_all_ipv6(done) {
var req = dns.lookup('www.google.com', {all: true, family: 6},
function(err, ips) {
if (err) throw err;
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);

ips.forEach(function(ip) {
assert.ok(isIPv6(ip.address),
'Invalid IPv6: ' + ip.address.toString());
assert.strictEqual(ip.family, 6);
});

done();
});
var req = dns.lookup(
'www.google.com',
{all: true, family: 6},
function(err, ips) {
if (err) throw err;
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);

ips.forEach(function(ip) {
assert.ok(isIPv6(ip.address),
'Invalid IPv6: ' + ip.address.toString());
assert.strictEqual(ip.family, 6);
});

done();
}
);

checkWrap(req);
});
Expand Down
Loading

0 comments on commit 289a836

Please sign in to comment.