summaryrefslogtreecommitdiff
path: root/test/gc
diff options
context:
space:
mode:
authorRoman Reiss <me@silverwind.io>2015-05-19 13:00:06 +0200
committerRoman Reiss <me@silverwind.io>2015-05-19 21:21:27 +0200
commitf29762f4dd5811464684f820286f1c90a694bdff (patch)
tree67ba73a81c3938f41796dfa4c595f9713de59933 /test/gc
parent85d99830096a48b7d50cc3b0e5c3fba4172c2d02 (diff)
downloadnode-new-f29762f4dd5811464684f820286f1c90a694bdff.tar.gz
test: enable linting for tests
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>
Diffstat (limited to 'test/gc')
-rw-r--r--test/gc/node_modules/weak/lib/weak.js3
-rw-r--r--test/gc/test-http-client-connaborted.js11
-rw-r--r--test/gc/test-http-client-onerror.js11
-rw-r--r--test/gc/test-http-client-timeout.js19
-rw-r--r--test/gc/test-http-client.js15
-rw-r--r--test/gc/test-net-timeout.js9
6 files changed, 37 insertions, 31 deletions
diff --git a/test/gc/node_modules/weak/lib/weak.js b/test/gc/node_modules/weak/lib/weak.js
index 8081a76c45..535caf615c 100644
--- a/test/gc/node_modules/weak/lib/weak.js
+++ b/test/gc/node_modules/weak/lib/weak.js
@@ -1,3 +1,4 @@
+'use strict';
var bindings
try {
bindings = require('../build/Release/weakref.node')
@@ -13,6 +14,6 @@ module.exports = bindings.create
// backwards-compat with node-weakref
bindings.weaken = bindings.create
-Object.keys(bindings).forEach(function (name) {
+Object.keys(bindings).forEach(function(name) {
module.exports[name] = bindings[name]
})
diff --git a/test/gc/test-http-client-connaborted.js b/test/gc/test-http-client-connaborted.js
index c58b4d5f75..20a4b38481 100644
--- a/test/gc/test-http-client-connaborted.js
+++ b/test/gc/test-http-client-connaborted.js
@@ -1,3 +1,4 @@
+'use strict';
// just like test/gc/http-client.js,
// but aborting every connection that comes in.
@@ -15,7 +16,7 @@ var http = require('http'),
assert = require('assert'),
PORT = common.PORT;
-console.log('We should do '+ todo +' requests');
+console.log('We should do ' + todo + ' requests');
var http = require('http');
var server = http.createServer(serverHandler);
@@ -25,9 +26,9 @@ function getall() {
if (count >= todo)
return;
- (function(){
+ (function() {
function cb(res) {
- done+=1;
+ done += 1;
statusLater();
}
@@ -39,7 +40,7 @@ function getall() {
count++;
weak(req, afterGC);
- })()
+ })();
setImmediate(getall);
}
@@ -47,7 +48,7 @@ function getall() {
for (var i = 0; i < 10; i++)
getall();
-function afterGC(){
+function afterGC() {
countGC ++;
}
diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js
index bf9fb7c1fb..98d046e180 100644
--- a/test/gc/test-http-client-onerror.js
+++ b/test/gc/test-http-client-onerror.js
@@ -1,3 +1,4 @@
+'use strict';
// just like test/gc/http-client.js,
// but with an on('error') handler that does nothing.
@@ -17,7 +18,7 @@ var http = require('http'),
assert = require('assert'),
PORT = common.PORT;
-console.log('We should do '+ todo +' requests');
+console.log('We should do ' + todo + ' requests');
var http = require('http');
var server = http.createServer(serverHandler);
@@ -27,10 +28,10 @@ function getall() {
if (count >= todo)
return;
- (function(){
+ (function() {
function cb(res) {
res.resume();
- done+=1;
+ done += 1;
statusLater();
}
function onerror(er) {
@@ -45,7 +46,7 @@ function getall() {
count++;
weak(req, afterGC);
- })()
+ })();
setImmediate(getall);
}
@@ -53,7 +54,7 @@ function getall() {
for (var i = 0; i < 10; i++)
getall();
-function afterGC(){
+function afterGC() {
countGC ++;
}
diff --git a/test/gc/test-http-client-timeout.js b/test/gc/test-http-client-timeout.js
index 727d133f71..5bb2d2b05b 100644
--- a/test/gc/test-http-client-timeout.js
+++ b/test/gc/test-http-client-timeout.js
@@ -1,10 +1,11 @@
+'use strict';
// just like test/gc/http-client.js,
// but with a timeout set
function serverHandler(req, res) {
- setTimeout(function () {
+ setTimeout(function() {
req.resume();
- res.writeHead(200)
+ res.writeHead(200);
res.end('hello\n');
}, 100);
}
@@ -19,7 +20,7 @@ var http = require('http'),
assert = require('assert'),
PORT = common.PORT;
-console.log('We should do '+ todo +' requests');
+console.log('We should do ' + todo + ' requests');
var http = require('http');
var server = http.createServer(serverHandler);
@@ -29,10 +30,10 @@ function getall() {
if (count >= todo)
return;
- (function(){
+ (function() {
function cb(res) {
res.resume();
- done+=1;
+ done += 1;
statusLater();
}
@@ -42,13 +43,13 @@ function getall() {
port: PORT
}, cb);
req.on('error', cb);
- req.setTimeout(10, function(){
- console.log('timeout (expected)')
+ req.setTimeout(10, function() {
+ console.log('timeout (expected)');
});
count++;
weak(req, afterGC);
- })()
+ })();
setImmediate(getall);
}
@@ -56,7 +57,7 @@ function getall() {
for(var i = 0; i < 10; i++)
getall();
-function afterGC(){
+function afterGC() {
countGC ++;
}
diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js
index 6aedda7ede..7c3259d38b 100644
--- a/test/gc/test-http-client.js
+++ b/test/gc/test-http-client.js
@@ -1,3 +1,4 @@
+'use strict';
// just a simple http server and client.
function serverHandler(req, res) {
@@ -15,7 +16,7 @@ var http = require('http'),
assert = require('assert'),
PORT = common.PORT;
-console.log('We should do '+ todo +' requests');
+console.log('We should do ' + todo + ' requests');
var http = require('http');
var server = http.createServer(serverHandler);
@@ -26,11 +27,11 @@ function getall() {
if (count >= todo)
return;
- (function(){
+ (function() {
function cb(res) {
res.resume();
- console.error('in cb')
- done+=1;
+ console.error('in cb');
+ done += 1;
res.on('end', gc);
}
@@ -38,11 +39,11 @@ function getall() {
hostname: 'localhost',
pathname: '/',
port: PORT
- }, cb)
+ }, cb);
count++;
weak(req, afterGC);
- })()
+ })();
setImmediate(getall);
}
@@ -50,7 +51,7 @@ function getall() {
for (var i = 0; i < 10; i++)
getall();
-function afterGC(){
+function afterGC() {
countGC ++;
}
diff --git a/test/gc/test-net-timeout.js b/test/gc/test-net-timeout.js
index 2ef03b2632..6c3b4f245b 100644
--- a/test/gc/test-net-timeout.js
+++ b/test/gc/test-net-timeout.js
@@ -1,3 +1,4 @@
+'use strict';
// just like test/gc/http-client-timeout.js,
// but using a net server/client instead
@@ -11,7 +12,7 @@ function serverHandler(sock) {
sock.on('error', function(err) {
assert.strictEqual(err.code, 'ECONNRESET');
});
- timer = setTimeout(function () {
+ timer = setTimeout(function() {
sock.end('hello\n');
}, 100);
}
@@ -26,7 +27,7 @@ var net = require('net'),
assert = require('assert'),
PORT = common.PORT;
-console.log('We should do '+ todo +' requests');
+console.log('We should do ' + todo + ' requests');
var server = net.createServer(serverHandler);
server.listen(PORT, getall);
@@ -35,7 +36,7 @@ function getall() {
if (count >= todo)
return;
- (function(){
+ (function() {
var req = net.connect(PORT, '127.0.0.1');
req.resume();
req.setTimeout(10, function() {
@@ -55,7 +56,7 @@ function getall() {
for (var i = 0; i < 10; i++)
getall();
-function afterGC(){
+function afterGC() {
countGC ++;
}