summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorColton Baker <github@netrefuge.net>2011-10-04 18:08:18 -0400
committerRyan Dahl <ry@tinyclouds.org>2011-10-05 18:51:06 -0700
commit87286cc7371886d9856edf424785aaa890ba05a9 (patch)
tree0a3e93be28b8ebb62d9b774919d29b2c1600fa46 /test
parent627f379f2273341426ab3d5cb7eb4d5c148d500a (diff)
downloadnode-new-87286cc7371886d9856edf424785aaa890ba05a9.tar.gz
Fixed a lot of jslint errors.
Fixes #1831
Diffstat (limited to 'test')
-rw-r--r--test/common.js2
-rw-r--r--test/disabled/GH-670.js4
-rw-r--r--test/disabled/test-child-process-uid-gid.js31
-rw-r--r--test/disabled/test-dgram-multicast.js2
-rw-r--r--test/disabled/test-http-agent2.js6
-rw-r--r--test/disabled/test-http-big-proxy-responses.js14
-rw-r--r--test/disabled/test-http-default-port.js38
-rw-r--r--test/disabled/test-http-head-request.js4
-rw-r--r--test/disabled/test-https-loop-to-google.js40
-rw-r--r--test/disabled/test-tls-large-push.js2
-rw-r--r--test/disabled/test-tls-server.js8
-rw-r--r--test/disabled/tls-client.js6
-rw-r--r--test/fixtures/GH-892-request.js2
-rw-r--r--test/fixtures/breakpoints.js4
-rw-r--r--test/fixtures/child-process-channel.js2
-rw-r--r--test/fixtures/node_modules/asdf.js2
-rw-r--r--test/fixtures/node_modules/bar.js2
-rw-r--r--test/fixtures/node_modules/baz/index.js2
-rw-r--r--test/fixtures/node_modules/baz/node_modules/asdf.js2
-rw-r--r--test/fixtures/node_modules/foo.js2
-rw-r--r--test/fixtures/node_modules/node_modules/bar.js2
-rw-r--r--test/fixtures/packages/main-index/package-main-module/index.js2
-rw-r--r--test/fixtures/packages/main/package-main-module.js2
-rw-r--r--test/fixtures/test-init-index/index.js3
-rw-r--r--test/fixtures/test-init-native/fs.js3
-rw-r--r--test/internet/test-dns.js8
-rw-r--r--test/message/throw_custom_error.js2
-rw-r--r--test/message/throw_non_error.js2
-rw-r--r--test/pummel/test-http-upload-timeout.js4
-rw-r--r--test/pummel/test-https-large-response.js16
-rw-r--r--test/pummel/test-net-write-callbacks.js6
-rw-r--r--test/pummel/test-next-tick-loops-quick.js17
-rw-r--r--test/pummel/test-tls-throttle.js6
-rw-r--r--test/pummel/test-vm-memleak.js6
-rw-r--r--test/simple/test-assert.js22
-rw-r--r--test/simple/test-buffer.js95
-rw-r--r--test/simple/test-child-process-channel.js4
-rw-r--r--test/simple/test-child-process-customfd-bounded.js2
-rw-r--r--test/simple/test-child-process-cwd.js2
-rw-r--r--test/simple/test-child-process-double-pipe.js18
-rw-r--r--test/simple/test-child-process-env.js2
-rw-r--r--test/simple/test-child-process-exec-cwd.js4
-rw-r--r--test/simple/test-child-process-exec-env.js2
-rw-r--r--test/simple/test-child-process-set-blocking.js8
-rw-r--r--test/simple/test-cli-eval.js2
-rw-r--r--test/simple/test-console-not-call-toString.js4
-rw-r--r--test/simple/test-console.js4
-rw-r--r--test/simple/test-crypto-random.js6
-rw-r--r--test/simple/test-crypto.js88
-rw-r--r--test/simple/test-debugger-client.js64
-rw-r--r--test/simple/test-debugger-repl.js6
-rw-r--r--test/simple/test-error-reporting.js3
-rw-r--r--test/simple/test-eval.js5
-rw-r--r--test/simple/test-event-emitter-once.js2
-rw-r--r--test/simple/test-file-write-stream2.js6
-rw-r--r--test/simple/test-file-write-stream3.js14
-rw-r--r--test/simple/test-fs-open.js3
-rw-r--r--test/simple/test-fs-watch-file.js56
-rw-r--r--test/simple/test-fs-watch.js110
-rw-r--r--test/simple/test-http-1.0.js64
-rw-r--r--test/simple/test-http-abort-client.js30
-rw-r--r--test/simple/test-http-agent.js6
-rw-r--r--test/simple/test-http-allow-req-after-204-res.js4
-rw-r--r--test/simple/test-http-buffer-sanity.js6
-rw-r--r--test/simple/test-http-chunked.js22
-rw-r--r--test/simple/test-http-client-abort.js26
-rw-r--r--test/simple/test-http-client-parse-error.js6
-rw-r--r--test/simple/test-http-client-upload-buf.js4
-rw-r--r--test/simple/test-http-client-upload.js4
-rw-r--r--test/simple/test-http-conn-reset.js3
-rw-r--r--test/simple/test-http-curl-chunk-problem.js4
-rw-r--r--test/simple/test-http-default-encoding.js2
-rw-r--r--test/simple/test-http-dns-error.js17
-rw-r--r--test/simple/test-http-dns-fail.js24
-rw-r--r--test/simple/test-http-expect-continue.js6
-rw-r--r--test/simple/test-http-extra-response.js26
-rw-r--r--test/simple/test-http-get-pipeline-problem.js12
-rw-r--r--test/simple/test-http-head-request.js4
-rw-r--r--test/simple/test-http-head-response-has-no-body-end.js4
-rw-r--r--test/simple/test-http-header-read.js6
-rw-r--r--test/simple/test-http-host-headers.js2
-rw-r--r--test/simple/test-http-keep-alive-close-on-header.js58
-rw-r--r--test/simple/test-http-keep-alive.js16
-rw-r--r--test/simple/test-http-many-keep-alive-connections.js2
-rw-r--r--test/simple/test-http-multi-line-headers.js20
-rw-r--r--test/simple/test-http-mutable-headers.js14
-rw-r--r--test/simple/test-http-request-end-twice.js2
-rw-r--r--test/simple/test-http-request-end.js2
-rw-r--r--test/simple/test-http-response-close.js8
-rw-r--r--test/simple/test-http-set-timeout.js6
-rw-r--r--test/simple/test-http-status-code.js4
-rw-r--r--test/simple/test-http-unix-socket.js13
-rw-r--r--test/simple/test-http-upgrade-agent.js12
-rw-r--r--test/simple/test-http-upgrade-client2.js6
-rw-r--r--test/simple/test-http.js4
-rw-r--r--test/simple/test-https-agent.js8
-rw-r--r--test/simple/test-https-connecting-to-http.js2
-rw-r--r--test/simple/test-https-eof-for-eom.js2
-rw-r--r--test/simple/test-https-foafssl.js35
-rw-r--r--test/simple/test-https-simple.js20
-rw-r--r--test/simple/test-init.js36
-rw-r--r--test/simple/test-module-load-list.js14
-rw-r--r--test/simple/test-module-loading.js8
-rw-r--r--test/simple/test-net-bytes-stats.js8
-rw-r--r--test/simple/test-net-connect-buffer.js8
-rw-r--r--test/simple/test-net-connect-timeout.js8
-rw-r--r--test/simple/test-net-create-connection.js2
-rw-r--r--test/simple/test-net-pingpong.js4
-rw-r--r--test/simple/test-net-server-try-ports.js14
-rw-r--r--test/simple/test-net-stream.js4
-rw-r--r--test/simple/test-os.js16
-rw-r--r--test/simple/test-path.js60
-rw-r--r--test/simple/test-pipe-file-to-http.js2
-rw-r--r--test/simple/test-pipe-stream.js7
-rw-r--r--test/simple/test-pipe.js6
-rw-r--r--test/simple/test-process-env.js2
-rw-r--r--test/simple/test-process-kill-null.js4
-rw-r--r--test/simple/test-process-wrap.js10
-rw-r--r--test/simple/test-querystring.js4
-rw-r--r--test/simple/test-readdouble.js4
-rw-r--r--test/simple/test-readfloat.js4
-rw-r--r--test/simple/test-regress-GH-1531.js14
-rw-r--r--test/simple/test-regress-GH-1726.js8
-rw-r--r--test/simple/test-regress-GH-784.js12
-rw-r--r--test/simple/test-regress-GH-819.js2
-rw-r--r--test/simple/test-regress-GH-877.js14
-rw-r--r--test/simple/test-regress-GH-892.js8
-rw-r--r--test/simple/test-regress-GH-897.js2
-rw-r--r--test/simple/test-repl.js8
-rw-r--r--test/simple/test-require-cache-without-stat.js4
-rw-r--r--test/simple/test-script-context.js6
-rw-r--r--test/simple/test-signal-handler.js4
-rw-r--r--test/simple/test-stdin-from-file.js3
-rw-r--r--test/simple/test-stream-pipe-cleanup.js38
-rw-r--r--test/simple/test-stream-pipe-event.js8
-rw-r--r--test/simple/test-stream-pipe-multi.js38
-rw-r--r--test/simple/test-tcp-wrap-connect.js8
-rw-r--r--test/simple/test-tcp-wrap-listen.js18
-rw-r--r--test/simple/test-tcp-wrap.js6
-rw-r--r--test/simple/test-timers-linked-list.js12
-rw-r--r--test/simple/test-tls-client-abort.js4
-rw-r--r--test/simple/test-tls-client-resume.js12
-rw-r--r--test/simple/test-tls-client-verify.js86
-rw-r--r--test/simple/test-tls-connect.js7
-rw-r--r--test/simple/test-tls-ext-key-usage.js9
-rw-r--r--test/simple/test-tls-junk-closes-server.js14
-rw-r--r--test/simple/test-tls-npn-server-client.js8
-rw-r--r--test/simple/test-tls-peer-certificate.js2
-rw-r--r--test/simple/test-tls-securepair-client.js6
-rw-r--r--test/simple/test-tls-securepair-server.js5
-rw-r--r--test/simple/test-tls-server-verify.js95
-rw-r--r--test/simple/test-tls-set-encoding.js2
-rw-r--r--test/simple/test-tls-sni-server-client.js8
-rw-r--r--test/simple/test-tty-wrap.js6
-rw-r--r--test/simple/test-util-inspect.js12
-rw-r--r--test/simple/test-vm-create-context-circular-reference.js3
-rw-r--r--test/simple/test-writedouble.js4
-rw-r--r--test/simple/test-writefloat.js8
-rw-r--r--test/simple/test-zlib.js132
159 files changed, 1103 insertions, 1060 deletions
diff --git a/test/common.js b/test/common.js
index 4e36a4867a..a906217823 100644
--- a/test/common.js
+++ b/test/common.js
@@ -69,7 +69,7 @@ exports.ddCommand = function(filename, kilobytes) {
exports.spawnPwd = function(options) {
var spawn = require('child_process').spawn;
- if (process.platform == "win32") {
+ if (process.platform == 'win32') {
return spawn('cmd.exe', ['/c', 'cd'], options);
} else {
return spawn('pwd', [], options);
diff --git a/test/disabled/GH-670.js b/test/disabled/GH-670.js
index 0888cb950f..b6eb0c1210 100644
--- a/test/disabled/GH-670.js
+++ b/test/disabled/GH-670.js
@@ -31,9 +31,7 @@ req.on('error', function(e) {
function loadDom() {
// Do a lot of computation to stall the process.
// In the meantime the socket will be disconnected.
- for (var i = 0; i < 1e8; i++) {
- ;
- }
+ for (var i = 0; i < 1e8; i++);
console.log('Dom loaded.');
}
diff --git a/test/disabled/test-child-process-uid-gid.js b/test/disabled/test-child-process-uid-gid.js
index 53e6c9d3da..03ba9fd5f9 100644
--- a/test/disabled/test-child-process-uid-gid.js
+++ b/test/disabled/test-child-process-uid-gid.js
@@ -22,15 +22,16 @@
// libuv-broken
-var assert = require("assert");
-var spawn = require("child_process").spawn;
+var assert = require('assert');
+var spawn = require('child_process').spawn;
var fs = require('fs');
var myUid = process.getuid();
var myGid = process.getgid();
if (myUid != 0) {
- console.error('must be run as root, otherwise the gid/uid setting will fail.');
+ console.error('must be run as root, otherwise the gid/uid setting will' +
+ ' fail.');
process.exit(1);
}
@@ -39,9 +40,9 @@ if (myUid != 0) {
var passwd = fs.readFileSync('/etc/passwd', 'utf8');
passwd = passwd.trim().split(/\n/);
-for (var i = 0, l = passwd.length; i < l; i ++) {
- if (passwd[i].charAt(0) === "#") continue;
- passwd[i] = passwd[i].split(":");
+for (var i = 0, l = passwd.length; i < l; i++) {
+ if (passwd[i].charAt(0) === '#') continue;
+ passwd[i] = passwd[i].split(':');
var otherName = passwd[i][0];
var otherUid = +passwd[i][2];
var otherGid = +passwd[i][3];
@@ -62,20 +63,20 @@ whoNumber.stdout.buf = 'byNumber:';
whoName.stdout.buf = 'byName:';
whoNumber.stdout.on('data', onData);
whoName.stdout.on('data', onData);
-function onData (c) { this.buf += c; }
+function onData(c) { this.buf += c; }
-whoNumber.on("exit", onExit);
-whoName.on("exit", onExit);
+whoNumber.on('exit', onExit);
+whoName.on('exit', onExit);
-function onExit (code) {
+function onExit(code) {
var buf = this.stdout.buf;
console.log(buf);
- var expr = new RegExp("^(byName|byNumber):uid=" +
+ var expr = new RegExp('^(byName|byNumber):uid=' +
otherUid +
- "\\(" +
+ '\\(' +
otherName +
- "\\) gid=" +
+ '\\) gid=' +
otherGid +
- "\\(");
- assert.ok(buf.match(expr), "uid and gid should match " + otherName);
+ '\\(');
+ assert.ok(buf.match(expr), 'uid and gid should match ' + otherName);
}
diff --git a/test/disabled/test-dgram-multicast.js b/test/disabled/test-dgram-multicast.js
index f3a546fb20..3b78d6e379 100644
--- a/test/disabled/test-dgram-multicast.js
+++ b/test/disabled/test-dgram-multicast.js
@@ -82,7 +82,7 @@ function mkListener() {
if (receivedMessages.length == sendMessages.length) {
listenSocket.dropMembership(LOCAL_BROADCAST_HOST);
process.nextTick(function() { // TODO should be changed to below.
- // listenSocket.dropMembership(LOCAL_BROADCAST_HOST, function() {
+ // listenSocket.dropMembership(LOCAL_BROADCAST_HOST, function() {
listenSocket.close();
});
}
diff --git a/test/disabled/test-http-agent2.js b/test/disabled/test-http-agent2.js
index 9ea266789e..40e4beac4d 100644
--- a/test/disabled/test-http-agent2.js
+++ b/test/disabled/test-http-agent2.js
@@ -30,7 +30,7 @@ var reqEndCount = 0;
var server = http.Server(function(req, res) {
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
var buffer = '';
@@ -50,7 +50,7 @@ var responses = 0;
var N = 10;
var M = 10;
-var body = ''
+var body = '';
for (var i = 0; i < 1000; i++) {
body += 'hello world';
}
@@ -63,7 +63,7 @@ var options = {
server.listen(common.PORT, function() {
for (var i = 0; i < N; i++) {
- setTimeout(function () {
+ setTimeout(function() {
for (var j = 0; j < M; j++) {
var req = http.request(options, function(res) {
diff --git a/test/disabled/test-http-big-proxy-responses.js b/test/disabled/test-http-big-proxy-responses.js
index e43ea7a40e..2d84d9984c 100644
--- a/test/disabled/test-http-big-proxy-responses.js
+++ b/test/disabled/test-http-big-proxy-responses.js
@@ -58,10 +58,10 @@ var proxy = http.createServer(function(req, res) {
}
var proxy_req = http.request({
- host: 'localhost',
- port: 9000,
- method: req.method,
- path: req.url,
+ host: 'localhost',
+ port: 9000,
+ method: req.method,
+ path: req.url,
headers: req.headers
}, function(proxy_res) {
res.writeHead(proxy_res.statusCode, proxy_res.headers);
@@ -96,9 +96,9 @@ function call_chargen(list) {
var recved = 0;
var req = http.request({
- port: 9001,
- host: 'localhost',
- path: '/',
+ port: 9001,
+ host: 'localhost',
+ path: '/',
headers: {'x-len': len}
}, function(res) {
diff --git a/test/disabled/test-http-default-port.js b/test/disabled/test-http-default-port.js
index b1bccf0fa7..a5372801df 100644
--- a/test/disabled/test-http-default-port.js
+++ b/test/disabled/test-http-default-port.js
@@ -24,44 +24,44 @@
// This must be run as root.
-var http = require("http"),
- https = require("https"),
+var http = require('http'),
+ https = require('https'),
PORT = 80,
SSLPORT = 443,
- assert = require("assert"),
- hostExpect = "localhost",
- fs = require("fs"),
- path = require("path"),
- fixtures = path.resolve(__dirname, "../fixtures/keys"),
+ assert = require('assert'),
+ hostExpect = 'localhost',
+ fs = require('fs'),
+ path = require('path'),
+ fixtures = path.resolve(__dirname, '../fixtures/keys'),
options = {
key: fs.readFileSync(fixtures + '/agent1-key.pem'),
cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
};
-http.createServer(function (req, res) {
+http.createServer(function(req, res) {
console.error(req.headers);
assert.equal(req.headers.host, hostExpect);
res.writeHead(200);
- res.end("ok");
+ res.end('ok');
this.close();
}).listen(PORT);
-https.createServer(options, function (req, res) {
+https.createServer(options, function(req, res) {
console.error(req.headers);
assert.equal(req.headers.host, hostExpect);
res.writeHead(200);
- res.end("ok");
+ res.end('ok');
this.close();
}).listen(SSLPORT);
http
- .get({ host: "localhost",
- port: PORT,
- headers: { "x-port": PORT } })
- .on("response", function(res) {});
+ .get({ host: 'localhost',
+ port: PORT,
+ headers: { 'x-port': PORT } })
+ .on('response', function(res) {});
https
- .get({ host: "localhost",
- port: SSLPORT,
- headers: { "x-port": SSLPORT } })
- .on("response", function(res) {});
+ .get({ host: 'localhost',
+ port: SSLPORT,
+ headers: { 'x-port': SSLPORT } })
+ .on('response', function(res) {});
diff --git a/test/disabled/test-http-head-request.js b/test/disabled/test-http-head-request.js
index 8b0f40074f..362a33aabf 100644
--- a/test/disabled/test-http-head-request.js
+++ b/test/disabled/test-http-head-request.js
@@ -46,9 +46,9 @@ var gotEnd = false;
server.addListener('listening', function() {
var request = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'HEAD',
- path: '/'
+ path: '/'
}, function(response) {
console.log('got response');
response.addListener('data', function() {
diff --git a/test/disabled/test-https-loop-to-google.js b/test/disabled/test-https-loop-to-google.js
index bfa8663076..371fb5f720 100644
--- a/test/disabled/test-https-loop-to-google.js
+++ b/test/disabled/test-https-loop-to-google.js
@@ -30,26 +30,26 @@
var https = require('https');
-for(var i = 0; i < 10; ++i)
+for (var i = 0; i < 10; ++i)
{
https.get(
- {
- host: 'www.google.com',
- path: '/accounts/o8/id',
- port: 443,
- }, function(res)
- {
- var data = '';
- res.on('data', function(chunk)
- {
- data += chunk;
- });
- res.on('end', function()
- {
- console.log(res.statusCode);
- });
- }).on('error', function(error)
- {
- console.log(error);
- });
+ {
+ host: 'www.google.com',
+ path: '/accounts/o8/id',
+ port: 443
+ }, function(res)
+ {
+ var data = '';
+ res.on('data', function(chunk)
+ {
+ data += chunk;
+ });
+ res.on('end', function()
+ {
+ console.log(res.statusCode);
+ });
+ }).on('error', function(error)
+ {
+ console.log(error);
+ });
}
diff --git a/test/disabled/test-tls-large-push.js b/test/disabled/test-tls-large-push.js
index 55855f9e73..7fee6b0bd6 100644
--- a/test/disabled/test-tls-large-push.js
+++ b/test/disabled/test-tls-large-push.js
@@ -33,7 +33,7 @@ var fs = require('fs');
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 10*1024*1024; i++) {
+for (var i = 0; i < 10 * 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
diff --git a/test/disabled/test-tls-server.js b/test/disabled/test-tls-server.js
index 9723920659..daf2e0ba59 100644
--- a/test/disabled/test-tls-server.js
+++ b/test/disabled/test-tls-server.js
@@ -38,10 +38,10 @@ var key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
var cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
s = tls.Server({ key: key,
- cert: cert,
- ca: [],
- requestCert: true,
- rejectUnauthorized: true });
+ cert: cert,
+ ca: [],
+ requestCert: true,
+ rejectUnauthorized: true });
s.listen(common.PORT, function() {
console.log('TLS server on 127.0.0.1:%d', common.PORT);
diff --git a/test/disabled/tls-client.js b/test/disabled/tls-client.js
index 4ce9e58196..91c553ec5b 100644
--- a/test/disabled/tls-client.js
+++ b/test/disabled/tls-client.js
@@ -30,13 +30,13 @@ var fs = require('fs');
// most servers don't require certificates
var options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem')
};
-var s = tls.connect(443, "joyent.com", options, function() {
+var s = tls.connect(443, 'joyent.com', options, function() {
if (!s.authorized) {
- console.error("CONNECTED: " + s.authorizationError);
+ console.error('CONNECTED: ' + s.authorizationError);
s.destroy();
return;
}
diff --git a/test/fixtures/GH-892-request.js b/test/fixtures/GH-892-request.js
index e205d05da6..a43398e984 100644
--- a/test/fixtures/GH-892-request.js
+++ b/test/fixtures/GH-892-request.js
@@ -38,7 +38,7 @@ var options = {
var req = https.request(options, function(res) {
assert.equal(200, res.statusCode);
gotResponse = true;
- console.error("DONE");
+ console.error('DONE');
});
req.end(new Buffer(bytesExpected));
diff --git a/test/fixtures/breakpoints.js b/test/fixtures/breakpoints.js
index 4ea4c129c2..c22a560676 100644
--- a/test/fixtures/breakpoints.js
+++ b/test/fixtures/breakpoints.js
@@ -6,10 +6,10 @@ function a(x) {
while (--i != 0);
debugger;
return i;
-};
+}
function b() {
return ['hello', 'world'].join(' ');
-};
+}
a();
a(1);
b();
diff --git a/test/fixtures/child-process-channel.js b/test/fixtures/child-process-channel.js
index 802d046d32..a7af584b9d 100644
--- a/test/fixtures/child-process-channel.js
+++ b/test/fixtures/child-process-channel.js
@@ -1,6 +1,6 @@
var assert = require('assert');
-console.log("NODE_CHANNEL_FD", process.env.NODE_CHANNEL_FD);
+console.log('NODE_CHANNEL_FD', process.env.NODE_CHANNEL_FD);
assert.ok(process.env.NODE_CHANNEL_FD);
var fd = parseInt(process.env.NODE_CHANNEL_FD);
diff --git a/test/fixtures/node_modules/asdf.js b/test/fixtures/node_modules/asdf.js
index 6cf68cadb4..84b74de9d9 100644
--- a/test/fixtures/node_modules/asdf.js
+++ b/test/fixtures/node_modules/asdf.js
@@ -20,5 +20,5 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
throw new Error('Should not ever get here.');
diff --git a/test/fixtures/node_modules/bar.js b/test/fixtures/node_modules/bar.js
index 8162473a06..5d00c9592e 100644
--- a/test/fixtures/node_modules/bar.js
+++ b/test/fixtures/node_modules/bar.js
@@ -20,4 +20,4 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
diff --git a/test/fixtures/node_modules/baz/index.js b/test/fixtures/node_modules/baz/index.js
index 84f587f2a1..043c6d0dc0 100644
--- a/test/fixtures/node_modules/baz/index.js
+++ b/test/fixtures/node_modules/baz/index.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
// this should work, and get the one that doesn't throw
var assert = require('assert');
assert.equal(require('bar'), require('../bar.js'));
diff --git a/test/fixtures/node_modules/baz/node_modules/asdf.js b/test/fixtures/node_modules/baz/node_modules/asdf.js
index 8162473a06..5d00c9592e 100644
--- a/test/fixtures/node_modules/baz/node_modules/asdf.js
+++ b/test/fixtures/node_modules/baz/node_modules/asdf.js
@@ -20,4 +20,4 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
diff --git a/test/fixtures/node_modules/foo.js b/test/fixtures/node_modules/foo.js
index c554bdd29b..5f0236de3c 100644
--- a/test/fixtures/node_modules/foo.js
+++ b/test/fixtures/node_modules/foo.js
@@ -20,6 +20,6 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
var assert = require('assert');
assert.equal(require('baz'), require('./baz/index.js'));
diff --git a/test/fixtures/node_modules/node_modules/bar.js b/test/fixtures/node_modules/node_modules/bar.js
index 6cf68cadb4..84b74de9d9 100644
--- a/test/fixtures/node_modules/node_modules/bar.js
+++ b/test/fixtures/node_modules/node_modules/bar.js
@@ -20,5 +20,5 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
throw new Error('Should not ever get here.');
diff --git a/test/fixtures/packages/main-index/package-main-module/index.js b/test/fixtures/packages/main-index/package-main-module/index.js
index f65d3a27d3..c361a6dc8d 100644
--- a/test/fixtures/packages/main-index/package-main-module/index.js
+++ b/test/fixtures/packages/main-index/package-main-module/index.js
@@ -19,4 +19,4 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-exports.ok = "ok"
+exports.ok = 'ok';
diff --git a/test/fixtures/packages/main/package-main-module.js b/test/fixtures/packages/main/package-main-module.js
index f65d3a27d3..c361a6dc8d 100644
--- a/test/fixtures/packages/main/package-main-module.js
+++ b/test/fixtures/packages/main/package-main-module.js
@@ -19,4 +19,4 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-exports.ok = "ok"
+exports.ok = 'ok';
diff --git a/test/fixtures/test-init-index/index.js b/test/fixtures/test-init-index/index.js
index 702035d81f..31272c8995 100644
--- a/test/fixtures/test-init-index/index.js
+++ b/test/fixtures/test-init-index/index.js
@@ -21,4 +21,5 @@
(function() {
require('util').print('Loaded successfully!');
-})(); \ No newline at end of file
+})();
+
diff --git a/test/fixtures/test-init-native/fs.js b/test/fixtures/test-init-native/fs.js
index df106c3bc5..06392c68d1 100644
--- a/test/fixtures/test-init-native/fs.js
+++ b/test/fixtures/test-init-native/fs.js
@@ -24,4 +24,5 @@
if (fs.readFile) {
require('util').print('fs loaded successfully');
}
-})(); \ No newline at end of file
+})();
+
diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js
index 28a7a2d994..44f0c257ed 100644
--- a/test/internet/test-dns.js
+++ b/test/internet/test-dns.js
@@ -19,9 +19,9 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-var assert = require('assert');
+var assert = require('assert'),
dns = require('dns'),
- net = require('net_uv');
+ net = require('net_uv'),
isIP = net.isIP,
isIPv4 = net.isIPv4,
isIPv6 = net.isIPv6,
@@ -149,7 +149,7 @@ TEST(function test_reverse_bogus(done) {
var req = dns.reverse('bogus ip', function() {
assert.ok(false);
});
- } catch(e) {
+ } catch (e) {
error = e;
}
@@ -315,7 +315,7 @@ TEST(function test_lookup_ipv6_implicit(done) {
TEST(function test_lookup_failure(done) {
var req = dns.lookup('does.not.exist', 4, function(err, ip, family) {
assert.ok(err instanceof Error);
- assert.strictEqual(err.errno, dns.NOTFOUND)
+ assert.strictEqual(err.errno, dns.NOTFOUND);
uv && assert.strictEqual(err.errno, 'ENOTFOUND');
done();
diff --git a/test/message/throw_custom_error.js b/test/message/throw_custom_error.js
index 8479daa686..65842c8cff 100644
--- a/test/message/throw_custom_error.js
+++ b/test/message/throw_custom_error.js
@@ -28,6 +28,6 @@ var assert = require('assert');
common.error('before');
// custom error throwing
-throw { name: 'MyCustomError', message: 'This is a custom message' };
+throw { name: 'MyCustomError', message: 'This is a custom message' }
common.error('after');
diff --git a/test/message/throw_non_error.js b/test/message/throw_non_error.js
index 24eac3aece..9a901de713 100644
--- a/test/message/throw_non_error.js
+++ b/test/message/throw_non_error.js
@@ -28,6 +28,6 @@ var assert = require('assert');
common.error('before');
// custom error throwing
-throw { foo : 'bar' };
+throw { foo: 'bar' }
common.error('after');
diff --git a/test/pummel/test-http-upload-timeout.js b/test/pummel/test-http-upload-timeout.js
index fa5bb85ecd..417749cde9 100644
--- a/test/pummel/test-http-upload-timeout.js
+++ b/test/pummel/test-http-upload-timeout.js
@@ -36,7 +36,7 @@ server.on('request', function(req, res) {
req.on('end', function() {
connections--;
res.writeHead(200);
- res.end("done\n");
+ res.end('done\n');
if (connections == 0) {
server.close();
}
@@ -51,7 +51,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
var request = http.request({
port: common.PORT,
method: 'POST',
- path: '/'
+ path: '/'
});
function ping() {
diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js
index b1e308ae69..13d8f61379 100644
--- a/test/pummel/test-https-large-response.js
+++ b/test/pummel/test-https-large-response.js
@@ -37,12 +37,12 @@ var reqCount = 0;
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 1024*1024; i++) {
+for (var i = 0; i < 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
-var server = https.createServer(options, function (req, res) {
+var server = https.createServer(options, function(req, res) {
reqCount++;
console.log('got request');
res.writeHead(200, { 'content-type': 'text/plain' });
@@ -52,23 +52,23 @@ var server = https.createServer(options, function (req, res) {
var count = 0;
var gotResEnd = false;
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
https.get({ port: common.PORT }, function(res) {
- console.log("response!");
+ console.log('response!');
res.on('data', function(d) {
process.stdout.write('.');
count += d.length;
res.pause();
- process.nextTick(function () {
+ process.nextTick(function() {
res.resume();
});
});
res.on('end', function(d) {
process.stdout.write('\n');
- console.log("expected: ", body.length);
- console.log(" got: ", count);
+ console.log('expected: ', body.length);
+ console.log(' got: ', count);
server.close();
gotResEnd = true;
});
@@ -76,7 +76,7 @@ server.listen(common.PORT, function () {
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(1, reqCount);
assert.equal(body.length, count);
assert.ok(gotResEnd);
diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js
index c923e58ecb..45d1d59f3c 100644
--- a/test/pummel/test-net-write-callbacks.js
+++ b/test/pummel/test-net-write-callbacks.js
@@ -28,11 +28,11 @@ var N = 500000;
var server = net.Server(function(socket) {
socket.on('data', function(d) {
- console.error("got %d bytes", d.length);
+ console.error('got %d bytes', d.length);
});
socket.on('end', function() {
- console.error("end");
+ console.error('end');
socket.destroy();
server.close();
});
@@ -43,7 +43,7 @@ server.listen(common.PORT, function() {
client.on('connect', function() {
for (var i = 0; i < N; i++) {
- client.write("hello world", function() {
+ client.write('hello world', function() {
cbcount++;
});
}
diff --git a/test/pummel/test-next-tick-loops-quick.js b/test/pummel/test-next-tick-loops-quick.js
index f08972c68b..9aeeb5ae1e 100644
--- a/test/pummel/test-next-tick-loops-quick.js
+++ b/test/pummel/test-next-tick-loops-quick.js
@@ -28,19 +28,20 @@ var assert = require('assert');
// Regression test GH-511: https://github.com/ry/node/issues/issue/511
// Make sure nextTick loops quickly
-setTimeout(function () {
- t = Date.now() - t;
- STOP = 1;
- console.log(["ctr: ",ctr, ", t:", t, "ms -> ", (ctr/t).toFixed(2), "KHz"].join(''));
- assert.ok(ctr > 1000);
+setTimeout(function() {
+ t = Date.now() - t;
+ STOP = 1;
+ console.log(['ctr: ', ctr, ', t:', t, 'ms -> ', (ctr / t).toFixed(2), 'KHz']
+ .join(''));
+ assert.ok(ctr > 1000);
}, 2000);
var ctr = 0;
var STOP = 0;
-var t = Date.now()+ 2;
-while (t > Date.now()) ; //get in sync with clock
+var t = Date.now() + 2;
+while (t > Date.now()); //get in sync with clock
-(function foo () {
+(function foo() {
if (STOP) return;
process.nextTick(foo);
ctr++;
diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js
index cd749d511c..c3c194f710 100644
--- a/test/pummel/test-tls-throttle.js
+++ b/test/pummel/test-tls-throttle.js
@@ -33,7 +33,7 @@ var fs = require('fs');
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 1024*1024; i++) {
+for (var i = 0; i < 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
@@ -62,7 +62,7 @@ server.listen(common.PORT, function() {
recvCount += d.length;
client.pause();
- process.nextTick(function () {
+ process.nextTick(function() {
client.resume();
});
});
@@ -82,7 +82,7 @@ function displayCounts() {
}
-var timeout = setTimeout(displayCounts, 10*1000);
+var timeout = setTimeout(displayCounts, 10 * 1000);
process.on('exit', function() {
diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js
index e946f19603..e0b087d81b 100644
--- a/test/pummel/test-vm-memleak.js
+++ b/test/pummel/test-vm-memleak.js
@@ -28,21 +28,21 @@ var maxMem = 0;
var interval = setInterval(function() {
try {
require('vm').runInNewContext('throw 1;');
- } catch(e) {
+ } catch (e) {
}
var rss = process.memoryUsage().rss;
maxMem = Math.max(rss, maxMem);
- if (Date.now() - start > 5*1000) {
+ if (Date.now() - start > 5 * 1000) {
// wait 10 seconds.
clearInterval(interval);
}
}, 1);
process.on('exit', function() {
- console.error('max mem: %dmb', Math.round(maxMem / (1024*1024)));
+ console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024)));
// make sure we stay below 100mb
assert.ok(maxMem < 50 * 1024 * 1024);
});
diff --git a/test/simple/test-assert.js b/test/simple/test-assert.js
index 3bd1715970..9a3b021f3c 100644
--- a/test/simple/test-assert.js
+++ b/test/simple/test-assert.js
@@ -196,22 +196,22 @@ assert.doesNotThrow(function() {assert.ifError()});
threw = false;
try {
assert.throws(
- function() {
- throw {};
- },
- Array
+ function() {
+ throw {}
+ },
+ Array
);
-} catch(e) {
+} catch (e) {
threw = true;
}
-assert.ok(threw, "wrong constructor validation");
+assert.ok(threw, 'wrong constructor validation');
// use a RegExp to validate error message
a.throws(makeBlock(thrower, TypeError), /test/);
// use a fn to validate error object
a.throws(makeBlock(thrower, TypeError), function(err) {
- if ( (err instanceof TypeError) && /test/.test(err)) {
+ if ((err instanceof TypeError) && /test/.test(err)) {
return true;
}
});
@@ -228,7 +228,7 @@ c.b = c;
var gotError = false;
try {
assert.deepEqual(b, c);
-} catch(e) {
+} catch (e) {
gotError = true;
}
@@ -257,12 +257,12 @@ testAssertionMessage(-Infinity, '"-Infinity"');
testAssertionMessage('', '""');
testAssertionMessage('foo', '"foo"');
testAssertionMessage([], '[]');
-testAssertionMessage([1,2,3], '[1,2,3]');
+testAssertionMessage([1, 2, 3], '[1,2,3]');
testAssertionMessage(/a/, '"/a/"');
testAssertionMessage(/abc/gim, '"/abc/gim"');
testAssertionMessage(function f() {}, '"function f() {}"');
testAssertionMessage({}, '{}');
-testAssertionMessage({a:undefined, b:null}, '{"a":"undefined","b":null}');
-testAssertionMessage({a:NaN, b:Infinity, c:-Infinity},
+testAssertionMessage({a: undefined, b: null}, '{"a":"undefined","b":null}');
+testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
'{"a":"NaN","b":"Infinity","c":"-Infinity"}');
diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js
index fdd3a365e2..23a0d84a14 100644
--- a/test/simple/test-buffer.js
+++ b/test/simple/test-buffer.js
@@ -260,7 +260,8 @@ var f = new Buffer([0, 0, 0, 0, 0]);
assert.equal(f.length, 5);
var size = f.write('あいうえお', 'ucs2');
console.error('bytes written to buffer: %d (should be 4)', size);
-console.error('chars written to buffer: %d (should be 2)', Buffer._charsWritten);
+console.error('chars written to buffer: %d (should be 2)',
+ Buffer._charsWritten);
assert.equal(size, 4);
assert.equal(Buffer._charsWritten, 2);
assert.deepEqual(f, new Buffer([0x42, 0x30, 0x44, 0x30, 0x00]));
@@ -411,7 +412,7 @@ assert.equal(dot.toString('base64'), '//4uAA==');
// Writing base64 at a position > 0 should not mangle the result.
//
// https://github.com/joyent/node/issues/402
-var segments = ['TWFkbmVzcz8h','IFRoaXM=','IGlz','IG5vZGUuanMh'];
+var segments = ['TWFkbmVzcz8h', 'IFRoaXM=', 'IGlz', 'IG5vZGUuanMh'];
var buf = new Buffer(64);
var pos = 0;
@@ -455,37 +456,37 @@ assert.equal(0, Buffer('hello').slice(0, 0).length);
// test hex toString
console.log('Create hex string from buffer');
var hexb = new Buffer(256);
-for (var i = 0; i < 256; i ++) {
+for (var i = 0; i < 256; i++) {
hexb[i] = i;
}
var hexStr = hexb.toString('hex');
assert.equal(hexStr,
- '000102030405060708090a0b0c0d0e0f'+
- '101112131415161718191a1b1c1d1e1f'+
- '202122232425262728292a2b2c2d2e2f'+
- '303132333435363738393a3b3c3d3e3f'+
- '404142434445464748494a4b4c4d4e4f'+
- '505152535455565758595a5b5c5d5e5f'+
- '606162636465666768696a6b6c6d6e6f'+
- '707172737475767778797a7b7c7d7e7f'+
- '808182838485868788898a8b8c8d8e8f'+
- '909192939495969798999a9b9c9d9e9f'+
- 'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf'+
- 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebf'+
- 'c0c1c2c3c4c5c6c7c8c9cacbcccdcecf'+
- 'd0d1d2d3d4d5d6d7d8d9dadbdcdddedf'+
- 'e0e1e2e3e4e5e6e7e8e9eaebecedeeef'+
+ '000102030405060708090a0b0c0d0e0f' +
+ '101112131415161718191a1b1c1d1e1f' +
+ '202122232425262728292a2b2c2d2e2f' +
+ '303132333435363738393a3b3c3d3e3f' +
+ '404142434445464748494a4b4c4d4e4f' +
+ '505152535455565758595a5b5c5d5e5f' +
+ '606162636465666768696a6b6c6d6e6f' +
+ '707172737475767778797a7b7c7d7e7f' +
+ '808182838485868788898a8b8c8d8e8f' +
+ '909192939495969798999a9b9c9d9e9f' +
+ 'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf' +
+ 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebf' +
+ 'c0c1c2c3c4c5c6c7c8c9cacbcccdcecf' +
+ 'd0d1d2d3d4d5d6d7d8d9dadbdcdddedf' +
+ 'e0e1e2e3e4e5e6e7e8e9eaebecedeeef' +
'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff');
console.log('Create buffer from hex string');
var hexb2 = new Buffer(hexStr, 'hex');
-for (var i = 0; i < 256; i ++) {
+for (var i = 0; i < 256; i++) {
assert.equal(hexb2[i], hexb[i]);
}
// test an invalid slice end.
console.log('Try to slice off the end of the buffer');
-var b = new Buffer([1,2,3,4,5]);
+var b = new Buffer([1, 2, 3, 4, 5]);
var b2 = b.toString('hex', 1, 10000);
var b3 = b.toString('hex', 1, 5);
var b4 = b.toString('hex', 1);
@@ -496,25 +497,25 @@ assert.equal(b2, b4);
// Test slice on SlowBuffer GH-843
var SlowBuffer = process.binding('buffer').SlowBuffer;
-function buildSlowBuffer (data) {
+function buildSlowBuffer(data) {
if (Array.isArray(data)) {
var buffer = new SlowBuffer(data.length);
- data.forEach(function(v,k) {
+ data.forEach(function(v, k) {
buffer[k] = v;
});
return buffer;
- };
+ }
return null;
}
-var x = buildSlowBuffer([0x81,0xa3,0x66,0x6f,0x6f,0xa3,0x62,0x61,0x72]);
+var x = buildSlowBuffer([0x81, 0xa3, 0x66, 0x6f, 0x6f, 0xa3, 0x62, 0x61, 0x72]);
-console.log(x.inspect())
+console.log(x.inspect());
assert.equal('<SlowBuffer 81 a3 66 6f 6f a3 62 61 72>', x.inspect());
var z = x.slice(4);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(5, z.length);
assert.equal(0x6f, z[0]);
assert.equal(0xa3, z[1]);
@@ -523,41 +524,41 @@ assert.equal(0x61, z[3]);
assert.equal(0x72, z[4]);
var z = x.slice(0);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(z.length, x.length);
var z = x.slice(0, 4);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(4, z.length);
assert.equal(0x81, z[0]);
assert.equal(0xa3, z[1]);
var z = x.slice(0, 9);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(9, z.length);
var z = x.slice(1, 4);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(3, z.length);
assert.equal(0xa3, z[0]);
var z = x.slice(2, 4);
-console.log(z.inspect())
-console.log(z.length)
+console.log(z.inspect());
+console.log(z.length);
assert.equal(2, z.length);
assert.equal(0x66, z[0]);
assert.equal(0x6f, z[1]);
-assert.equal(0, Buffer('hello').slice(0, 0).length)
+assert.equal(0, Buffer('hello').slice(0, 0).length);
b = new Buffer(50);
-b.fill("h");
+b.fill('h');
for (var i = 0; i < b.length; i++) {
- assert.equal("h".charCodeAt(0), b[i]);
+ assert.equal('h'.charCodeAt(0), b[i]);
}
b.fill(0);
@@ -577,13 +578,13 @@ assert.equal(b.toString('ucs2'), 'あいうえお');
// Binary encoding should write only one byte per character.
var b = Buffer([0xde, 0xad, 0xbe, 0xef]);
var s = String.fromCharCode(0xffff);
-b.write(s, 0, 'binary')
+b.write(s, 0, 'binary');
assert.equal(0xff, b[0]);
assert.equal(0xad, b[1]);
assert.equal(0xbe, b[2]);
assert.equal(0xef, b[3]);
s = String.fromCharCode(0xaaee);
-b.write(s, 0, 'binary')
+b.write(s, 0, 'binary');
assert.equal(0xee, b[0]);
assert.equal(0xad, b[1]);
assert.equal(0xbe, b[2]);
@@ -592,7 +593,7 @@ assert.equal(0xef, b[3]);
// This should not segfault the program.
assert.throws(function() {
- new Buffer('"pong"', 0, 6, 8031, '127.0.0.1')
+ new Buffer('"pong"', 0, 6, 8031, '127.0.0.1');
});
// #1210 Test UTF-8 string includes null character
@@ -696,9 +697,9 @@ Buffer(3.3).toString(); // throws bad argument error in commit 43cb4ec
assert.equal(Buffer(-1).length, 0);
assert.equal(Buffer(NaN).length, 0);
assert.equal(Buffer(3.3).length, 4);
-assert.equal(Buffer({length:3.3}).length, 4);
-assert.equal(Buffer({length:"BAM"}).length, 0);
+assert.equal(Buffer({length: 3.3}).length, 4);
+assert.equal(Buffer({length: 'BAM'}).length, 0);
// Make sure that strings are not coerced to numbers.
-assert.equal(Buffer("99").length, 2);
-assert.equal(Buffer("13.37").length, 5); \ No newline at end of file
+assert.equal(Buffer('99').length, 2);
+assert.equal(Buffer('13.37').length, 5);
diff --git a/test/simple/test-child-process-channel.js b/test/simple/test-child-process-channel.js
index 47d09d8e17..d7230a2692 100644
--- a/test/simple/test-child-process-channel.js
+++ b/test/simple/test-child-process-channel.js
@@ -4,12 +4,12 @@ var common = require('../common');
var sub = common.fixturesDir + '/child-process-channel.js';
-var child = spawn(process.execPath, [ sub ], {
+var child = spawn(process.execPath, [sub], {
customFds: [0, 1, 2],
wantChannel: true
});
-console.log("fds", child.fds);
+console.log('fds', child.fds);
assert.ok(child.fds.length == 4);
assert.ok(child.fds[3] >= 0);
diff --git a/test/simple/test-child-process-customfd-bounded.js b/test/simple/test-child-process-customfd-bounded.js
index 450259d592..203e6acaf3 100644
--- a/test/simple/test-child-process-customfd-bounded.js
+++ b/test/simple/test-child-process-customfd-bounded.js
@@ -3,6 +3,6 @@ var common = require('../common');
var bigish = Array(200);
for (var i = 0, il = bigish.length; i < il; ++i)
- bigish[i] = -1;
+ bigish[i] = -1;
common.spawnPwd({ customFds: bigish });
diff --git a/test/simple/test-child-process-cwd.js b/test/simple/test-child-process-cwd.js
index 4260b39716..7321758e7d 100644
--- a/test/simple/test-child-process-cwd.js
+++ b/test/simple/test-child-process-cwd.js
@@ -53,7 +53,7 @@ function testCwd(options, forCode, forData) {
}
// Assume these exist, and 'pwd' gives us the right directory back
-if (process.platform == "win32") {
+if (process.platform == 'win32') {
testCwd({cwd: process.env.windir}, 0, process.env.windir);
testCwd({cwd: 'c:\\'}, 0, 'c:\\');
} else {
diff --git a/test/simple/test-child-process-double-pipe.js b/test/simple/test-child-process-double-pipe.js
index 64ac85ed0a..9795bb45bf 100644
--- a/test/simple/test-child-process-double-pipe.js
+++ b/test/simple/test-child-process-double-pipe.js
@@ -47,7 +47,7 @@ var echo = spawn('echo', ['hello\nnode\nand\nworld\n']),
// pipe echo | grep
echo.stdout.on('data', function(data) {
- console.error("grep stdin write " + data.length);
+ console.error('grep stdin write ' + data.length);
if (!grep.stdin.write(data)) {
echo.stdout.pause();
}
@@ -63,22 +63,22 @@ echo.stdout.on('end', function(code) {
});
echo.on('exit', function() {
- console.error("echo exit");
-})
+ console.error('echo exit');
+});
grep.on('exit', function() {
- console.error("grep exit");
-})
+ console.error('grep exit');
+});
sed.on('exit', function() {
- console.error("sed exit");
-})
+ console.error('sed exit');
+});
// pipe grep | sed
grep.stdout.on('data', function(data) {
- console.error("grep stdout " + data.length);
+ console.error('grep stdout ' + data.length);
if (!sed.stdin.write(data)) {
grep.stdout.pause();
}
@@ -90,7 +90,7 @@ sed.stdin.on('drain', function(data) {
// propagate end from grep to sed
grep.stdout.on('end', function(code) {
- console.error("grep stdout end");
+ console.error('grep stdout end');
sed.stdin.end();
});
diff --git a/test/simple/test-child-process-env.js b/test/simple/test-child-process-env.js
index d06338d126..d624ee130b 100644
--- a/test/simple/test-child-process-env.js
+++ b/test/simple/test-child-process-env.js
@@ -31,7 +31,7 @@ var env = {
};
env.__proto__ = {
'FOO': 'BAR'
-}
+};
if (isWindows) {
var child = spawn('cmd.exe', ['/c', 'set'], {env: env});
diff --git a/test/simple/test-child-process-exec-cwd.js b/test/simple/test-child-process-exec-cwd.js
index 5e82ff5dd7..2751b90781 100644
--- a/test/simple/test-child-process-exec-cwd.js
+++ b/test/simple/test-child-process-exec-cwd.js
@@ -29,10 +29,10 @@ var error_count = 0;
var pwdcommand, dir;
if (process.platform == 'win32') {
- pwdcommand = 'echo %cd%';
+ pwdcommand = 'echo %cd%';
dir = 'c:\\windows';
} else {
- pwdcommand = 'pwd';
+ pwdcommand = 'pwd';
dir = '/dev';
}
diff --git a/test/simple/test-child-process-exec-env.js b/test/simple/test-child-process-exec-env.js
index faf4b37af0..c82fc069c5 100644
--- a/test/simple/test-child-process-exec-env.js
+++ b/test/simple/test-child-process-exec-env.js
@@ -55,7 +55,7 @@ child.stdout.addListener('data', function(chunk) {
});
process.addListener('exit', function() {
- console.log("response: ", response);
+ console.log('response: ', response);
assert.equal(1, success_count);
assert.equal(0, error_count);
assert.ok(response.indexOf('HELLO=WORLD') >= 0);
diff --git a/test/simple/test-child-process-set-blocking.js b/test/simple/test-child-process-set-blocking.js
index 6362e8d4c0..030b6829c6 100644
--- a/test/simple/test-child-process-set-blocking.js
+++ b/test/simple/test-child-process-set-blocking.js
@@ -21,16 +21,16 @@
var common = require('../common');
var assert = require('assert');
-var ch = require("child_process")
+var ch = require('child_process');
-var SIZE = 100000
+var SIZE = 100000;
var childGone = false;
-var cp = ch.spawn("python", ['-c', 'print ' + SIZE + ' * "C"'], {
+var cp = ch.spawn('python', ['-c', 'print ' + SIZE + ' * "C"'], {
customFds: [0, 1, 2]
});
-cp.on("exit", function (code) {
+cp.on('exit', function(code) {
childGone = true;
assert.equal(0, code);
});
diff --git a/test/simple/test-cli-eval.js b/test/simple/test-cli-eval.js
index a51fdedf9c..98e8dc90c2 100644
--- a/test/simple/test-cli-eval.js
+++ b/test/simple/test-cli-eval.js
@@ -43,7 +43,7 @@ child.exec(nodejs + ' --eval 42',
// assert that "42\n" is written to stderr
child.exec(nodejs + ' --eval "console.error(42)"',
function(err, stdout, stderr) {
- assert.equal(stderr, "42\n");
+ assert.equal(stderr, '42\n');
});
// assert that module loading works
diff --git a/test/simple/test-console-not-call-toString.js b/test/simple/test-console-not-call-toString.js
index 5193f29c34..647f4d4436 100644
--- a/test/simple/test-console-not-call-toString.js
+++ b/test/simple/test-console-not-call-toString.js
@@ -25,9 +25,9 @@
var common = require('../common');
var assert = require('assert');
-var func = function () {};
+var func = function() {};
var toStringCalled = false;
-func.toString = function () {
+func.toString = function() {
toStringCalled = true;
};
diff --git a/test/simple/test-console.js b/test/simple/test-console.js
index 8cdf36b14b..fd4494dca4 100644
--- a/test/simple/test-console.js
+++ b/test/simple/test-console.js
@@ -41,7 +41,7 @@ global.process.stdout.write = function(string) {
console.log('foo');
console.log('foo', 'bar');
console.log('%s %s', 'foo', 'bar', 'hop');
-console.log({slashes: '\\\\'})
+console.log({slashes: '\\\\'});
global.process.stdout.write = stdout_write;
assert.equal('foo\n', strings.shift());
@@ -49,4 +49,4 @@ assert.equal('foo bar\n', strings.shift());
assert.equal('foo bar hop\n', strings.shift());
assert.equal("{ slashes: '\\\\\\\\' }\n", strings.shift());
-assert.equal(true, process.stderr.write("hello world"));
+assert.equal(true, process.stderr.write('hello world'));
diff --git a/test/simple/test-crypto-random.js b/test/simple/test-crypto-random.js
index 150dc847e1..284c7ed11d 100644
--- a/test/simple/test-crypto-random.js
+++ b/test/simple/test-crypto-random.js
@@ -32,10 +32,10 @@ try {
// bump, we register a lot of exit listeners
process.setMaxListeners(256);
-[ crypto.randomBytes,
+[crypto.randomBytes,
crypto.pseudoRandomBytes
].forEach(function(f) {
- [ -1,
+ [-1,
undefined,
null,
false,
@@ -44,7 +44,7 @@ process.setMaxListeners(256);
[]
].forEach(function(value) {
assert.throws(function() { f(value); });
- assert.throws(function() { f(value, function(){}); });
+ assert.throws(function() { f(value, function() {}); });
});
[0, 1, 2, 4, 16, 256, 1024].forEach(function(len) {
diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js
index 48cef1d4fa..5a028f06d2 100644
--- a/test/simple/test-crypto.js
+++ b/test/simple/test-crypto.js
@@ -39,8 +39,10 @@ var path = require('path');
var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
-var rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem', 'ascii');
-var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem', 'ascii');
+var rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
+ 'ascii');
+var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
+ 'ascii');
try {
var credentials = crypto.createCredentials(
@@ -69,8 +71,8 @@ var rfc4231 = [
sha224: '896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22',
sha256: 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7',
sha384: 'afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6',
- sha512: '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854',
- },
+ sha512: '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854'
+ }
},
{
key: new Buffer('4a656665', 'hex'), // 'Jefe'
@@ -79,8 +81,8 @@ var rfc4231 = [
sha224: 'a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44',
sha256: '5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843',
sha384: 'af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649',
- sha512: '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737',
- },
+ sha512: '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737'
+ }
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
@@ -89,8 +91,8 @@ var rfc4231 = [
sha224: '7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea',
sha256: '773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe',
sha384: '88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27',
- sha512: 'fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb',
- },
+ sha512: 'fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb'
+ }
},
{
key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
@@ -99,8 +101,8 @@ var rfc4231 = [
sha224: '6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a',
sha256: '82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b',
sha384: '3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb',
- sha512: 'b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd',
- },
+ sha512: 'b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd'
+ }
},
{
key: new Buffer('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
@@ -109,9 +111,9 @@ var rfc4231 = [
sha224: '0e2aea68a90c8d37c988bcdb9fca6fa8',
sha256: 'a3b6167473100ee06e0c796c2955552b',
sha384: '3abf34c3503b2a23a46efc619baef897',
- sha512: '415fad6271580a531d4179bc891d87a6',
+ sha512: '415fad6271580a531d4179bc891d87a6'
},
- truncate: true,
+ truncate: true
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
@@ -120,8 +122,8 @@ var rfc4231 = [
sha224: '95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e',
sha256: '60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54',
sha384: '4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952',
- sha512: '80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598',
- },
+ sha512: '80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598'
+ }
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
@@ -130,9 +132,9 @@ var rfc4231 = [
sha224: '3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1',
sha256: '9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2',
sha384: '6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e',
- sha512: 'e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58',
- },
- },
+ sha512: 'e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58'
+ }
+ }
];
for (var i = 0, l = rfc4231.length; i < l; i++) {
@@ -145,7 +147,7 @@ for (var i = 0, l = rfc4231.length; i < l; i++) {
}
assert.equal(rfc4231[i]['hmac'][hash],
result,
- "Test HMAC-" + hash + ": Test case " + (i+1) + " rfc 4231");
+ 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' rfc 4231');
}
}
@@ -154,75 +156,75 @@ var rfc2202_md5 = [
{
key: new Buffer('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
data: 'Hi There',
- hmac: '9294727a3638bb1c13f48ef8158bfc9d',
+ hmac: '9294727a3638bb1c13f48ef8158bfc9d'
},
{
key: 'Jefe',
data: 'what do ya want for nothing?',
- hmac: '750c783e6ab0b503eaa86e310a5db738',
+ hmac: '750c783e6ab0b503eaa86e310a5db738'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: new Buffer('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
- hmac: '56be34521d144c88dbb8c733f0e8b3f6',
+ hmac: '56be34521d144c88dbb8c733f0e8b3f6'
},
{
key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
- hmac: '697eaf0aca3a3aea3a75164746ffaa79',
+ hmac: '697eaf0aca3a3aea3a75164746ffaa79'
},
{
key: new Buffer('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
data: 'Test With Truncation',
- hmac: '56461ef2342edc00f9bab995690efd4c',
+ hmac: '56461ef2342edc00f9bab995690efd4c'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: 'Test Using Larger Than Block-Size Key - Hash Key First',
- hmac: '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd',
+ hmac: '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
- hmac: '6f630fad67cda0ee1fb1f562db3aa53e',
- },
+ hmac: '6f630fad67cda0ee1fb1f562db3aa53e'
+ }
];
var rfc2202_sha1 = [
{
key: new Buffer('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
data: 'Hi There',
- hmac: 'b617318655057264e28bc0b6fb378c8ef146be00',
+ hmac: 'b617318655057264e28bc0b6fb378c8ef146be00'
},
{
key: 'Jefe',
data: 'what do ya want for nothing?',
- hmac: 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79',
+ hmac: 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: new Buffer('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
- hmac: '125d7342b9ac11cd91a39af48aa17b4f63f175d3',
+ hmac: '125d7342b9ac11cd91a39af48aa17b4f63f175d3'
},
{
key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
- hmac: '4c9007f4026250c6bc8414f9bf50c86c2d7235da',
+ hmac: '4c9007f4026250c6bc8414f9bf50c86c2d7235da'
},
{
key: new Buffer('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
data: 'Test With Truncation',
- hmac: '4c1a03424b55e07fe7f27be1d58bb9324a9a5a04',
+ hmac: '4c1a03424b55e07fe7f27be1d58bb9324a9a5a04'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: 'Test Using Larger Than Block-Size Key - Hash Key First',
- hmac: 'aa4ae5e15272d00e95705637ce8a3b55ed402112',
+ hmac: 'aa4ae5e15272d00e95705637ce8a3b55ed402112'
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
data: 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
- hmac: 'e8e99d0f45237d786d6bbaa7965c7808bbff1a91',
- },
+ hmac: 'e8e99d0f45237d786d6bbaa7965c7808bbff1a91'
+ }
];
for (var i = 0, l = rfc2202_md5.length; i < l; i++) {
@@ -230,14 +232,14 @@ for (var i = 0, l = rfc2202_md5.length; i < l; i++) {
crypto.createHmac('md5', rfc2202_md5[i]['key'])
.update(rfc2202_md5[i]['data'])
.digest('hex'),
- "Test HMAC-MD5 : Test case " + (i+1) + " rfc 2202");
+ 'Test HMAC-MD5 : Test case ' + (i + 1) + ' rfc 2202');
}
for (var i = 0, l = rfc2202_sha1.length; i < l; i++) {
assert.equal(rfc2202_sha1[i]['hmac'],
crypto.createHmac('sha1', rfc2202_sha1[i]['key'])
.update(rfc2202_sha1[i]['data'])
.digest('hex'),
- "Test HMAC-SHA1 : Test case " + (i+1) + " rfc 2202");
+ 'Test HMAC-SHA1 : Test case ' + (i + 1) + ' rfc 2202');
}
// Test hashing
@@ -314,8 +316,8 @@ assert.equal(txt, plaintext, 'encryption and decryption');
// encryption and decryption with Base64
// reported in https://github.com/joyent/node/issues/738
var plaintext =
- '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
- 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJjAfaFg**';
+ '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
+ 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJjAfaFg**';
var cipher = crypto.createCipher('aes256', '0123456789abcdef');
// encrypt plaintext which is in utf8 format
@@ -394,22 +396,22 @@ assert.equal(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), 1);
// Test PBKDF2 with RFC 6070 test vectors (except #4)
-crypto.pbkdf2('password', 'salt', 1, 20, function (err, result) {
+crypto.pbkdf2('password', 'salt', 1, 20, function(err, result) {
assert.equal(result, '\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6', 'pbkdf1 test vector 1');
});
-crypto.pbkdf2('password', 'salt', 2, 20, function (err, result) {
+crypto.pbkdf2('password', 'salt', 2, 20, function(err, result) {
assert.equal(result, '\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57', 'pbkdf1 test vector 2');
});
-crypto.pbkdf2('password', 'salt', 4096, 20, function (err, result) {
+crypto.pbkdf2('password', 'salt', 4096, 20, function(err, result) {
assert.equal(result, '\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1', 'pbkdf1 test vector 3');
});
-crypto.pbkdf2('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, function (err, result) {
+crypto.pbkdf2('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, function(err, result) {
assert.equal(result, '\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38', 'pbkdf1 test vector 5');
});
-crypto.pbkdf2('pass\0word', 'sa\0lt', 4096, 16, function (err, result) {
+crypto.pbkdf2('pass\0word', 'sa\0lt', 4096, 16, function(err, result) {
assert.equal(result, '\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3', 'pbkdf1 test vector 6');
});
diff --git a/test/simple/test-debugger-client.js b/test/simple/test-debugger-client.js
index 2c865f8d97..cc234caab6 100644
--- a/test/simple/test-debugger-client.js
+++ b/test/simple/test-debugger-client.js
@@ -31,15 +31,15 @@ var spawn = require('child_process').spawn;
var resCount = 0;
var p = new debug.Protocol();
-p.onResponse = function (res) {
+p.onResponse = function(res) {
resCount++;
};
-p.execute("Type: connect\r\n" +
- "V8-Version: 3.0.4.1\r\n" +
- "Protocol-Version: 1\r\n" +
- "Embedding-Host: node v0.3.3-pre\r\n" +
- "Content-Length: 0\r\n\r\n");
+p.execute('Type: connect\r\n' +
+ 'V8-Version: 3.0.4.1\r\n' +
+ 'Protocol-Version: 1\r\n' +
+ 'Embedding-Host: node v0.3.3-pre\r\n' +
+ 'Content-Length: 0\r\n\r\n');
assert.equal(1, resCount);
// Make sure split messages go in.
@@ -93,26 +93,26 @@ assert.equal(4, resCount);
var expectedConnections = 0;
var tests = [];
-function addTest (cb) {
+function addTest(cb) {
expectedConnections++;
tests.push(cb);
}
-addTest(function (client, done) {
- console.error("requesting version");
- client.reqVersion(function (err, v) {
+addTest(function(client, done) {
+ console.error('requesting version');
+ client.reqVersion(function(err, v) {
assert.ok(!err);
- console.log("version: %s", v);
+ console.log('version: %s', v);
assert.equal(process.versions.v8, v);
done();
});
});
-addTest(function (client, done) {
- console.error("requesting scripts");
- client.reqScripts(function (err) {
+addTest(function(client, done) {
+ console.error('requesting scripts');
+ client.reqScripts(function(err) {
assert.ok(!err);
- console.error("got %d scripts", Object.keys(client.scripts).length);
+ console.error('got %d scripts', Object.keys(client.scripts).length);
var foundMainScript = false;
for (var k in client.scripts) {
@@ -127,9 +127,9 @@ addTest(function (client, done) {
});
});
-addTest(function (client, done) {
- console.error("eval 2+2");
- client.reqEval("2+2", function (err, res) {
+addTest(function(client, done) {
+ console.error('eval 2+2');
+ client.reqEval('2+2', function(err, res) {
console.error(res);
assert.ok(!err);
assert.equal('4', res.text);
@@ -145,16 +145,16 @@ function doTest(cb, done) {
var nodeProcess = spawn(process.execPath,
['-e', 'setInterval(function () { console.log("blah"); }, 100);']);
- nodeProcess.stdout.once('data', function () {
- console.log(">>> new node process: %d", nodeProcess.pid);
- process.kill(nodeProcess.pid, "SIGUSR1");
- console.log(">>> signaling it with SIGUSR1");
+ nodeProcess.stdout.once('data', function() {
+ console.log('>>> new node process: %d', nodeProcess.pid);
+ process.kill(nodeProcess.pid, 'SIGUSR1');
+ console.log('>>> signaling it with SIGUSR1');
});
var didTryConnect = false;
nodeProcess.stderr.setEncoding('utf8');
- var b = ''
- nodeProcess.stderr.on('data', function (data) {
+ var b = '';
+ nodeProcess.stderr.on('data', function(data) {
b += data;
if (didTryConnect == false && /debugger listening on port/.test(b)) {
didTryConnect = true;
@@ -162,13 +162,13 @@ function doTest(cb, done) {
setTimeout(function() {
// Wait for some data before trying to connect
var c = new debug.Client();
- process.stdout.write(">>> connecting...");
- c.connect(debug.port)
- c.on('ready', function () {
+ process.stdout.write('>>> connecting...');
+ c.connect(debug.port);
+ c.on('ready', function() {
connectCount++;
- console.log("ready!");
- cb(c, function () {
- console.error(">>> killing node process %d\n\n", nodeProcess.pid);
+ console.log('ready!');
+ cb(c, function() {
+ console.error('>>> killing node process %d\n\n', nodeProcess.pid);
nodeProcess.kill();
done();
});
@@ -179,11 +179,11 @@ function doTest(cb, done) {
}
-function run () {
+function run() {
var t = tests[0];
if (!t) return;
- doTest(t, function () {
+ doTest(t, function() {
tests.shift();
run();
});
diff --git a/test/simple/test-debugger-repl.js b/test/simple/test-debugger-repl.js
index 6152fd4f47..088bb48903 100644
--- a/test/simple/test-debugger-repl.js
+++ b/test/simple/test-debugger-repl.js
@@ -73,7 +73,7 @@ function addTest(input, output) {
}
};
expected.push({input: input, lines: output, callback: next});
-};
+}
// Initial lines
addTest(null, [
@@ -140,13 +140,13 @@ addTest('c, bt', [
function finish() {
process.exit(0);
-};
+}
function quit() {
if (quit.called) return;
quit.called = true;
child.stdin.write('quit');
-};
+}
setTimeout(function() {
throw new Error('timeout!');
diff --git a/test/simple/test-error-reporting.js b/test/simple/test-error-reporting.js
index df547422ca..3819d3d126 100644
--- a/test/simple/test-error-reporting.js
+++ b/test/simple/test-error-reporting.js
@@ -30,7 +30,8 @@ var path = require('path');
var exits = 0;
function errExec(script, callback) {
- var cmd = '"' + process.argv[0] + '" "' + path.join(common.fixturesDir, script) + '"';
+ var cmd = '"' + process.argv[0] + '" "' +
+ path.join(common.fixturesDir, script) + '"';
return exec(cmd, function(err, stdout, stderr) {
// There was some error
assert.ok(err);
diff --git a/test/simple/test-eval.js b/test/simple/test-eval.js
index 4d55556686..da7d1e264c 100644
--- a/test/simple/test-eval.js
+++ b/test/simple/test-eval.js
@@ -30,8 +30,9 @@ var exec = require('child_process').exec;
var success_count = 0;
var error_count = 0;
-var cmd = [process.execPath, '-e', '"console.error(process.argv)"', 'foo', 'bar'].join(' ');
-var expected = util.format([process.execPath, 'foo', 'bar']) + "\n";
+var cmd = [process.execPath, '-e', '"console.error(process.argv)"', 'foo', 'bar']
+ .join(' ');
+var expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
var child = exec(cmd, function(err, stdout, stderr) {
if (err) {
console.log(err.toString());
diff --git a/test/simple/test-event-emitter-once.js b/test/simple/test-event-emitter-once.js
index 55f0f16b06..8ab7b6d388 100644
--- a/test/simple/test-event-emitter-once.js
+++ b/test/simple/test-event-emitter-once.js
@@ -36,7 +36,7 @@ e.emit('hello', 'a', 'b');
e.emit('hello', 'a', 'b');
var remove = function() {
- assert.fail(1,0, 'once->foo should not be emitted', '!');
+ assert.fail(1, 0, 'once->foo should not be emitted', '!');
};
e.once('foo', remove);
diff --git a/test/simple/test-file-write-stream2.js b/test/simple/test-file-write-stream2.js
index 58b03db495..9b5d7ffef0 100644
--- a/test/simple/test-file-write-stream2.js
+++ b/test/simple/test-file-write-stream2.js
@@ -40,13 +40,13 @@ var countDrains = 0;
process.on('exit', function() {
removeTestFile();
- if ( cb_occurred !== cb_expected) {
+ if (cb_occurred !== cb_expected) {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ 'events missing or out of order: "' +
+ cb_occurred + '" !== "' + cb_expected + '"');
}
});
diff --git a/test/simple/test-file-write-stream3.js b/test/simple/test-file-write-stream3.js
index ac4fe9bc05..013946217b 100644
--- a/test/simple/test-file-write-stream3.js
+++ b/test/simple/test-file-write-stream3.js
@@ -42,13 +42,13 @@ var fileDataExpected_3 = 'abcdefghij\u2026\u2026qrstuvwxyz';
process.on('exit', function() {
removeTestFile();
- if ( cb_occurred !== cb_expected) {
+ if (cb_occurred !== cb_expected) {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ 'events missing or out of order: "' +
+ cb_occurred + '" !== "' + cb_expected + '"');
}
});
@@ -195,10 +195,10 @@ function run_test_4() {
// Error: start must be >= zero
assert.throws(
- function() {
- file = fs.createWriteStream(filepath, options);
- },
- /start must be/
+ function() {
+ file = fs.createWriteStream(filepath, options);
+ },
+ /start must be/
);
}
diff --git a/test/simple/test-fs-open.js b/test/simple/test-fs-open.js
index 922c0335bb..ed87efa070 100644
--- a/test/simple/test-fs-open.js
+++ b/test/simple/test-fs-open.js
@@ -26,7 +26,8 @@ var fs = require('fs');
var caughtException = false;
try {
- // should throw ENOENT, not EBADF - see https://github.com/joyent/node/pull/1228
+ // should throw ENOENT, not EBADF
+ // see https://github.com/joyent/node/pull/1228
fs.openSync('/path/to/file/that/does/not/exist', 'r');
}
catch (e) {
diff --git a/test/simple/test-fs-watch-file.js b/test/simple/test-fs-watch-file.js
index af91aeb167..221a6d251f 100644
--- a/test/simple/test-fs-watch-file.js
+++ b/test/simple/test-fs-watch-file.js
@@ -49,53 +49,53 @@ process.addListener('exit', function() {
});
-fs.writeFileSync(filepathOne, "hello");
+fs.writeFileSync(filepathOne, 'hello');
assert.throws(
- function() {
- fs.watchFile(filepathOne);
- },
- function(e) {
- return e.message === 'watchFile requires a listener function';
- }
+ function() {
+ fs.watchFile(filepathOne);
+ },
+ function(e) {
+ return e.message === 'watchFile requires a listener function';
+ }
);
assert.doesNotThrow(
- function() {
- fs.watchFile(filepathOne, function(curr, prev) {
- fs.unwatchFile(filepathOne);
- ++watchSeenOne;
- });
- }
+ function() {
+ fs.watchFile(filepathOne, function(curr, prev) {
+ fs.unwatchFile(filepathOne);
+ ++watchSeenOne;
+ });
+ }
);
setTimeout(function() {
- fs.writeFileSync(filepathOne, "world");
+ fs.writeFileSync(filepathOne, 'world');
}, 1000);
process.chdir(testDir);
-fs.writeFileSync(filepathTwoAbs, "howdy");
+fs.writeFileSync(filepathTwoAbs, 'howdy');
assert.throws(
- function() {
- fs.watchFile(filepathTwo);
- },
- function(e) {
- return e.message === 'watchFile requires a listener function';
- }
+ function() {
+ fs.watchFile(filepathTwo);
+ },
+ function(e) {
+ return e.message === 'watchFile requires a listener function';
+ }
);
assert.doesNotThrow(
- function() {
- fs.watchFile(filepathTwo, function(curr, prev) {
- fs.unwatchFile(filepathTwo);
- ++watchSeenTwo;
- });
- }
+ function() {
+ fs.watchFile(filepathTwo, function(curr, prev) {
+ fs.unwatchFile(filepathTwo);
+ ++watchSeenTwo;
+ });
+ }
);
setTimeout(function() {
- fs.writeFileSync(filepathTwoAbs, "pardner");
+ fs.writeFileSync(filepathTwoAbs, 'pardner');
}, 1000);
diff --git a/test/simple/test-fs-watch.js b/test/simple/test-fs-watch.js
index d6c909c4cc..154bbecbe9 100644
--- a/test/simple/test-fs-watch.js
+++ b/test/simple/test-fs-watch.js
@@ -56,88 +56,88 @@ process.addListener('exit', function() {
});
-fs.writeFileSync(filepathOne, "hello");
+fs.writeFileSync(filepathOne, 'hello');
assert.throws(
- function() {
- fs.watch(filepathOne);
- },
- function(e) {
- return e.message === 'watch requires a listener function';
- }
+ function() {
+ fs.watch(filepathOne);
+ },
+ function(e) {
+ return e.message === 'watch requires a listener function';
+ }
);
assert.doesNotThrow(
- function() {
- var watcher = fs.watch(filepathOne, function(event, filename) {
- assert.equal('change', event);
- if (expectFilePath) {
- assert.equal('watch.txt', filename);
- } else {
- assert.equal(null, filename);
- }
- watcher.close();
- ++watchSeenOne;
- });
- }
+ function() {
+ var watcher = fs.watch(filepathOne, function(event, filename) {
+ assert.equal('change', event);
+ if (expectFilePath) {
+ assert.equal('watch.txt', filename);
+ } else {
+ assert.equal(null, filename);
+ }
+ watcher.close();
+ ++watchSeenOne;
+ });
+ }
);
setTimeout(function() {
- fs.writeFileSync(filepathOne, "world");
+ fs.writeFileSync(filepathOne, 'world');
}, 1000);
process.chdir(testDir);
-fs.writeFileSync(filepathTwoAbs, "howdy");
+fs.writeFileSync(filepathTwoAbs, 'howdy');
assert.throws(
- function() {
- fs.watch(filepathTwo);
- },
- function(e) {
- return e.message === 'watch requires a listener function';
- }
+ function() {
+ fs.watch(filepathTwo);
+ },
+ function(e) {
+ return e.message === 'watch requires a listener function';
+ }
);
assert.doesNotThrow(
- function() {
- var watcher = fs.watch(filepathTwo, function(event, filename) {
- assert.equal('change', event);
- if (expectFilePath) {
- assert.equal('hasOwnProperty', filename);
- } else {
- assert.equal(null, filename);
- }
- watcher.close();
- ++watchSeenTwo;
- });
- }
+ function() {
+ var watcher = fs.watch(filepathTwo, function(event, filename) {
+ assert.equal('change', event);
+ if (expectFilePath) {
+ assert.equal('hasOwnProperty', filename);
+ } else {
+ assert.equal(null, filename);
+ }
+ watcher.close();
+ ++watchSeenTwo;
+ });
+ }
);
setTimeout(function() {
- fs.writeFileSync(filepathTwoAbs, "pardner");
+ fs.writeFileSync(filepathTwoAbs, 'pardner');
}, 1000);
-try { fs.unlinkSync(filepathThree); } catch(e) {}
-try { fs.mkdirSync(testsubdir, 0700); } catch(e) {}
+try { fs.unlinkSync(filepathThree); } catch (e) {}
+try { fs.mkdirSync(testsubdir, 0700); } catch (e) {}
assert.doesNotThrow(
- function() {
- var watcher = fs.watch(testsubdir, function(event, filename) {
- assert.equal('rename', event);
- if (expectFilePath) {
- assert.equal('newfile.txt', filename);
- } else {
- assert.equal(null, filename);
- }
- watcher.close();
- ++watchSeenThree;
- });
- }
+ function() {
+ var watcher = fs.watch(testsubdir, function(event, filename) {
+ assert.equal('rename', event);
+ if (expectFilePath) {
+ assert.equal('newfile.txt', filename);
+ } else {
+ assert.equal(null, filename);
+ }
+ watcher.close();
+ ++watchSeenThree;
+ });
+ }
);
setTimeout(function() {
var fd = fs.openSync(filepathThree, 'w');
fs.closeSync(fd);
-}, 1000); \ No newline at end of file
+}, 1000);
diff --git a/test/simple/test-http-1.0.js b/test/simple/test-http-1.0.js
index 58a6921737..2ed1d13fb1 100644
--- a/test/simple/test-http-1.0.js
+++ b/test/simple/test-http-1.0.js
@@ -105,25 +105,25 @@ function test(handler, request_generator, response_validator) {
assert.equal(1, req.httpVersionMajor);
assert.equal(0, req.httpVersionMinor);
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write("Hello, "); res._send('');
- res.write("world!"); res._send('');
+ res.write('Hello, '); res._send('');
+ res.write('world!'); res._send('');
res.end();
}
function request_generator() {
- return ("GET / HTTP/1.0\r\n"
- + "User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n"
- + "Host: 127.0.0.1:1337\r\n"
- + "Accept: */*\r\n"
- + "\r\n");
+ return ('GET / HTTP/1.0\r\n' +
+ 'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' +
+ 'Host: 127.0.0.1:1337\r\n' +
+ 'Accept: */*\r\n' +
+ '\r\n');
}
function response_validator(server_response, client_got_eof, timed_out) {
- var expected_response = ("HTTP/1.1 200 OK\r\n"
- + "Content-Type: text/plain\r\n"
- + "Connection: close\r\n"
- + "\r\n"
- + "Hello, world!");
+ var expected_response = ('HTTP/1.1 200 OK\r\n' +
+ 'Content-Type: text/plain\r\n' +
+ 'Connection: close\r\n' +
+ '\r\n' +
+ 'Hello, world!');
assert.equal(expected_response, server_response.data);
assert.equal(1, server_response.chunks.length);
@@ -140,32 +140,32 @@ function test(handler, request_generator, response_validator) {
assert.equal(1, req.httpVersionMajor);
assert.equal(1, req.httpVersionMinor);
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write("Hello, "); res._send('');
- res.write("world!"); res._send('');
+ res.write('Hello, '); res._send('');
+ res.write('world!'); res._send('');
res.end();
}
function request_generator() {
- return ("GET / HTTP/1.1\r\n"
- + "User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n"
- + "Connection: close\r\n"
- + "Host: 127.0.0.1:1337\r\n"
- + "Accept: */*\r\n"
- + "\r\n");
+ return ('GET / HTTP/1.1\r\n' +
+ 'User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15\r\n' +
+ 'Connection: close\r\n' +
+ 'Host: 127.0.0.1:1337\r\n' +
+ 'Accept: */*\r\n' +
+ '\r\n');
}
function response_validator(server_response, client_got_eof, timed_out) {
- var expected_response = ("HTTP/1.1 200 OK\r\n"
- + "Content-Type: text/plain\r\n"
- + "Connection: close\r\n"
- + "Transfer-Encoding: chunked\r\n"
- + "\r\n"
- + "7\r\n"
- + "Hello, \r\n"
- + "6\r\n"
- + "world!\r\n"
- + "0\r\n"
- + "\r\n");
+ var expected_response = ('HTTP/1.1 200 OK\r\n' +
+ 'Content-Type: text/plain\r\n' +
+ 'Connection: close\r\n' +
+ 'Transfer-Encoding: chunked\r\n' +
+ '\r\n' +
+ '7\r\n' +
+ 'Hello, \r\n' +
+ '6\r\n' +
+ 'world!\r\n' +
+ '0\r\n' +
+ '\r\n');
assert.equal(expected_response, server_response.data);
assert.equal(1, server_response.chunks.length);
@@ -174,4 +174,4 @@ function test(handler, request_generator, response_validator) {
}
test(handler, request_generator, response_validator);
-})(); \ No newline at end of file
+})();
diff --git a/test/simple/test-http-abort-client.js b/test/simple/test-http-abort-client.js
index 54d5af6988..6acdd6f404 100644
--- a/test/simple/test-http-abort-client.js
+++ b/test/simple/test-http-abort-client.js
@@ -19,43 +19,43 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-var common = require("../common");
-var http = require("http");
-var assert = require("assert");
+var common = require('../common');
+var http = require('http');
+var assert = require('assert');
-var server = http.Server(function (req, res) {
- console.log("Server accepted request.");
+var server = http.Server(function(req, res) {
+ console.log('Server accepted request.');
res.writeHead(200);
- res.write("Part of my res.");
+ res.write('Part of my res.');
res.destroy();
});
-var responseClose = false
+var responseClose = false;
server.listen(common.PORT, function() {
var client = http.get({
port: common.PORT,
- headers: { connection: "keep-alive" }
+ headers: { connection: 'keep-alive' }
}, function(res) {
server.close();
- console.log("Got res: " + res.statusCode);
+ console.log('Got res: ' + res.statusCode);
console.dir(res.headers);
- res.on("data", function (chunk) {
- console.log("Read " + chunk.length + " bytes");
+ res.on('data', function(chunk) {
+ console.log('Read ' + chunk.length + ' bytes');
console.log(chunk.toString());
});
- res.on("end", function () {
- console.log("Response ended.");
+ res.on('end', function() {
+ console.log('Response ended.');
});
// it would be nice if this worked:
- res.on("close", function () {
- console.log("Response aborted");
+ res.on('close', function() {
+ console.log('Response aborted');
responseClose = true;
});
});
diff --git a/test/simple/test-http-agent.js b/test/simple/test-http-agent.js
index de98e26054..3ed6181e3c 100644
--- a/test/simple/test-http-agent.js
+++ b/test/simple/test-http-agent.js
@@ -28,7 +28,7 @@ var http = require('http');
var server = http.Server(function(req, res) {
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
var responses = 0;
@@ -37,9 +37,9 @@ var M = 10;
server.listen(common.PORT, function() {
for (var i = 0; i < N; i++) {
- setTimeout(function () {
+ setTimeout(function() {
for (var j = 0; j < M; j++) {
- http.get({ port: common.PORT, path: '/', }, function(res) {
+ http.get({ port: common.PORT, path: '/' }, function(res) {
console.log(res.statusCode);
if (++responses == N * M) server.close();
}).on('error', function(e) {
diff --git a/test/simple/test-http-allow-req-after-204-res.js b/test/simple/test-http-allow-req-after-204-res.js
index ece06014c3..8f89043094 100644
--- a/test/simple/test-http-allow-req-after-204-res.js
+++ b/test/simple/test-http-allow-req-after-204-res.js
@@ -43,9 +43,9 @@ function nextRequest() {
console.error('writing request: %s', method);
var request = http.request({
- port: common.PORT,
+ port: common.PORT,
method: method,
- path: '/'
+ path: '/'
}, function(response) {
response.on('end', function() {
if (methods.length == 0) {
diff --git a/test/simple/test-http-buffer-sanity.js b/test/simple/test-http-buffer-sanity.js
index 2209456b35..2e650d9b2f 100644
--- a/test/simple/test-http-buffer-sanity.js
+++ b/test/simple/test-http-buffer-sanity.js
@@ -69,9 +69,9 @@ web.listen(common.PORT, function() {
console.log('Making request');
var req = http.request({
- port: common.PORT,
- method: 'GET',
- path: '/',
+ port: common.PORT,
+ method: 'GET',
+ path: '/',
headers: { 'content-length': buffer.length }
}, function(res) {
console.log('Got response');
diff --git a/test/simple/test-http-chunked.js b/test/simple/test-http-chunked.js
index afda076fbb..c5def3de78 100644
--- a/test/simple/test-http-chunked.js
+++ b/test/simple/test-http-chunked.js
@@ -39,21 +39,25 @@ var server = http.createServer(function(req, res) {
});
server.listen(common.PORT, function() {
var data = '';
- var get = http.get({path:'/', host:'localhost', port:common.PORT}, function (x) {
- x.setEncoding('utf8')
- x.on('data', function (c) {data += c});
- x.on('error', function (e) {
+ var get = http.get({
+ path: '/',
+ host: 'localhost',
+ port: common.PORT
+ }, function(x) {
+ x.setEncoding('utf8');
+ x.on('data', function(c) {data += c});
+ x.on('error', function(e) {
throw e;
- })
- x.on('end', function () {
+ });
+ x.on('end', function() {
assert.equal('string', typeof data);
console.log('here is the response:');
assert.equal(UTF8_STRING, data);
console.log(data);
server.close();
- })
- })
- get.on('error', function (e) {throw e});
+ });
+ });
+ get.on('error', function(e) {throw e});
get.end();
});
diff --git a/test/simple/test-http-client-abort.js b/test/simple/test-http-client-abort.js
index d8436979f4..c9b5eb071f 100644
--- a/test/simple/test-http-client-abort.js
+++ b/test/simple/test-http-client-abort.js
@@ -26,26 +26,26 @@ var http = require('http');
var clientAborts = 0;
var server = http.Server(function(req, res) {
- console.log("Got connection");
+ console.log('Got connection');
res.writeHead(200);
- res.write("Working on it...");
+ res.write('Working on it...');
// I would expect an error event from req or res that the client aborted
// before completing the HTTP request / response cycle, or maybe a new
// event like "aborted" or something.
- req.on("aborted", function () {
+ req.on('aborted', function() {
clientAborts++;
- console.log("Got abort " + clientAborts);
+ console.log('Got abort ' + clientAborts);
if (clientAborts === N) {
- console.log("All aborts detected, you win.");
+ console.log('All aborts detected, you win.');
server.close();
}
});
// since there is already clientError, maybe that would be appropriate,
// since "error" is magical
- req.on("clientError", function () {
- console.log("Got clientError");
+ req.on('clientError', function() {
+ console.log('Got clientError');
});
});
@@ -54,18 +54,18 @@ var N = http.Agent.defaultMaxSockets - 1;
var requests = [];
server.listen(common.PORT, function() {
- console.log("Server listening.");
+ console.log('Server listening.');
for (var i = 0; i < N; i++) {
- console.log("Making client " + i);
+ console.log('Making client ' + i);
var options = { port: common.PORT, path: '/?id=' + i };
var req = http.get(options, function(res) {
- console.log("Client response code " + res.statusCode);
+ console.log('Client response code ' + res.statusCode);
if (++responses == N) {
- console.log("All clients connected, destroying.");
- requests.forEach(function (outReq) {
- console.log("abort");
+ console.log('All clients connected, destroying.');
+ requests.forEach(function(outReq) {
+ console.log('abort');
outReq.abort();
});
}
diff --git a/test/simple/test-http-client-parse-error.js b/test/simple/test-http-client-parse-error.js
index 1bfdd146e2..b2d0dace7f 100644
--- a/test/simple/test-http-client-parse-error.js
+++ b/test/simple/test-http-client-parse-error.js
@@ -38,10 +38,10 @@ var parseError = false;
srv.listen(common.PORT, '127.0.0.1', function() {
var req = http.request({
- host: '127.0.0.1',
- port: common.PORT,
+ host: '127.0.0.1',
+ port: common.PORT,
method: 'GET',
- path: '/'});
+ path: '/'});
req.end();
req.on('error', function(e) {
diff --git a/test/simple/test-http-client-upload-buf.js b/test/simple/test-http-client-upload-buf.js
index cb7e931787..ecc683a90a 100644
--- a/test/simple/test-http-client-upload-buf.js
+++ b/test/simple/test-http-client-upload-buf.js
@@ -47,9 +47,9 @@ server.listen(common.PORT);
server.addListener('listening', function() {
var req = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'POST',
- path: '/'
+ path: '/'
}, function(res) {
res.setEncoding('utf8');
res.addListener('data', function(chunk) {
diff --git a/test/simple/test-http-client-upload.js b/test/simple/test-http-client-upload.js
index e160d9fe55..54ec141602 100644
--- a/test/simple/test-http-client-upload.js
+++ b/test/simple/test-http-client-upload.js
@@ -48,9 +48,9 @@ server.listen(common.PORT);
server.addListener('listening', function() {
var req = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'POST',
- path: '/'
+ path: '/'
}, function(res) {
res.setEncoding('utf8');
res.addListener('data', function(chunk) {
diff --git a/test/simple/test-http-conn-reset.js b/test/simple/test-http-conn-reset.js
index 21c52547f7..49651bd9dc 100644
--- a/test/simple/test-http-conn-reset.js
+++ b/test/simple/test-http-conn-reset.js
@@ -53,4 +53,5 @@ function onListen() {
process.on('exit', function() {
assert.equal(caughtError, true);
-}); \ No newline at end of file
+});
+
diff --git a/test/simple/test-http-curl-chunk-problem.js b/test/simple/test-http-curl-chunk-problem.js
index d9ec9ab319..908b0dd57c 100644
--- a/test/simple/test-http-curl-chunk-problem.js
+++ b/test/simple/test-http-curl-chunk-problem.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -56,7 +56,7 @@ function maybeMakeRequest() {
var ddcmd = common.ddCommand(filename, 10240);
-console.log("dd command: ", ddcmd);
+console.log('dd command: ', ddcmd);
cp.exec(ddcmd, function(err, stdout, stderr) {
if (err) throw err;
diff --git a/test/simple/test-http-default-encoding.js b/test/simple/test-http-default-encoding.js
index 7bf23968c6..4e4741a061 100644
--- a/test/simple/test-http-default-encoding.js
+++ b/test/simple/test-http-default-encoding.js
@@ -40,7 +40,7 @@ var server = http.Server(function(req, res) {
}, 100);
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
server.listen(common.PORT, function() {
diff --git a/test/simple/test-http-dns-error.js b/test/simple/test-http-dns-error.js
index e3c8be76e5..8f211dafc6 100644
--- a/test/simple/test-http-dns-error.js
+++ b/test/simple/test-http-dns-error.js
@@ -36,7 +36,7 @@ host += host;
host += host;
function do_not_call() {
- throw new Error("This function should not have been called.");
+ throw new Error('This function should not have been called.');
}
function test(mod) {
@@ -44,17 +44,17 @@ function test(mod) {
// Bad host name should not throw an uncatchable exception.
// Ensure that there is time to attach an error listener.
- var req = mod.get({host:host, port:42}, do_not_call);
+ var req = mod.get({host: host, port: 42}, do_not_call);
req.on('error', function(err) {
- assert.equal(err.code, 'EBADNAME');
- actual_bad_requests++;
+ assert.equal(err.code, 'EBADNAME');
+ actual_bad_requests++;
});
// http.get() called req.end() for us
- var req = mod.request({method:'GET', host:host, port:42}, do_not_call);
+ var req = mod.request({method: 'GET', host: host, port: 42}, do_not_call);
req.on('error', function(err) {
- assert.equal(err.code, 'EBADNAME');
- actual_bad_requests++;
+ assert.equal(err.code, 'EBADNAME');
+ actual_bad_requests++;
});
req.end();
}
@@ -67,4 +67,5 @@ test(http);
process.on('exit', function() {
assert.equal(actual_bad_requests, expected_bad_requests);
-}); \ No newline at end of file
+});
+
diff --git a/test/simple/test-http-dns-fail.js b/test/simple/test-http-dns-fail.js
index 6b15af9cac..7d87b8e7f6 100644
--- a/test/simple/test-http-dns-fail.js
+++ b/test/simple/test-http-dns-fail.js
@@ -19,7 +19,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-/*
+/*
* Repeated requests for a domain that fails to resolve
* should trigger the error event after each attempt.
*/
@@ -28,32 +28,32 @@ var common = require('../common');
var assert = require('assert');
var http = require('http');
-var resDespiteError = false
-var hadError = 0
+var resDespiteError = false;
+var hadError = 0;
function httpreq(count) {
- if ( 1 < count ) return
+ if (1 < count) return;
var req = http.request({
- host:'not-a-real-domain-name.nobody-would-register-this-as-a-tld',
+ host: 'not-a-real-domain-name.nobody-would-register-this-as-a-tld',
port: 80,
path: '/',
method: 'GET'
}, function(res) {
- resDespiteError = true
+ resDespiteError = true;
});
- req.on('error', function(e){
+ req.on('error', function(e) {
console.log(e.message);
assert.strictEqual(e.code, 'ENOTFOUND');
- hadError++
- httpreq(count + 1)
- })
+ hadError++;
+ httpreq(count + 1);
+ });
- req.end()
+ req.end();
}
-httpreq(0)
+httpreq(0);
process.on('exit', function() {
diff --git a/test/simple/test-http-expect-continue.js b/test/simple/test-http-expect-continue.js
index 6d7bd51849..c6cdf030fa 100644
--- a/test/simple/test-http-expect-continue.js
+++ b/test/simple/test-http-expect-continue.js
@@ -52,9 +52,9 @@ server.listen(common.PORT);
server.addListener('listening', function() {
var req = http.request({
- port: common.PORT,
- method: 'POST',
- path: '/world',
+ port: common.PORT,
+ method: 'POST',
+ path: '/world',
headers: { 'Expect': '100-continue' }
});
common.debug('Client sending request...');
diff --git a/test/simple/test-http-extra-response.js b/test/simple/test-http-extra-response.js
index aa10bf3ec0..d986df52f6 100644
--- a/test/simple/test-http-extra-response.js
+++ b/test/simple/test-http-extra-response.js
@@ -30,25 +30,25 @@ var net = require('net');
var body = 'hello world\r\n';
var fullResponse =
- 'HTTP/1.1 500 Internal Server Error\r\n' +
- 'Content-Length: ' + body.length + '\r\n' +
- 'Content-Type: text/plain\r\n' +
- 'Date: Fri + 18 Feb 2011 06:22:45 GMT\r\n' +
- 'Host: 10.20.149.2\r\n' +
- 'Access-Control-Allow-Credentials: true\r\n' +
- 'Server: badly broken/0.1 (OS NAME)\r\n' +
- '\r\n' +
- body;
+ 'HTTP/1.1 500 Internal Server Error\r\n' +
+ 'Content-Length: ' + body.length + '\r\n' +
+ 'Content-Type: text/plain\r\n' +
+ 'Date: Fri + 18 Feb 2011 06:22:45 GMT\r\n' +
+ 'Host: 10.20.149.2\r\n' +
+ 'Access-Control-Allow-Credentials: true\r\n' +
+ 'Server: badly broken/0.1 (OS NAME)\r\n' +
+ '\r\n' +
+ body;
var gotResponse = false;
-var server = net.createServer(function (socket) {
+var server = net.createServer(function(socket) {
var postBody = '';
socket.setEncoding('utf8');
- socket.on('data', function (chunk) {
+ socket.on('data', function(chunk) {
postBody += chunk;
if (postBody.indexOf('\r\n') > -1) {
@@ -66,11 +66,11 @@ server.listen(common.PORT, function() {
console.log('Got res code: ' + res.statusCode);
res.setEncoding('utf8');
- res.on('data', function (chunk) {
+ res.on('data', function(chunk) {
buffer += chunk;
});
- res.on('end', function () {
+ res.on('end', function() {
console.log('Response ended, read ' + buffer.length + ' bytes');
assert.equal(body, buffer);
server.close();
diff --git a/test/simple/test-http-get-pipeline-problem.js b/test/simple/test-http-get-pipeline-problem.js
index 7a1501f4ab..e433f3b1b9 100644
--- a/test/simple/test-http-get-pipeline-problem.js
+++ b/test/simple/test-http-get-pipeline-problem.js
@@ -32,7 +32,7 @@ var fs = require('fs');
var image = fs.readFileSync(common.fixturesDir + '/person.jpg');
-console.log("image.length = " + image.length);
+console.log('image.length = ' + image.length);
var total = 100;
var requests = 0, responses = 0;
@@ -64,20 +64,20 @@ server.listen(common.PORT, function() {
};
http.get(opts, function(res) {
- console.error("recv " + x);
- var s = fs.createWriteStream(common.tmpDir + '/' + x + ".jpg");
+ console.error('recv ' + x);
+ var s = fs.createWriteStream(common.tmpDir + '/' + x + '.jpg');
res.pipe(s);
// TODO there should be a callback to pipe() that will allow
// us to get a callback when the pipe is finished.
res.on('end', function() {
- console.error("done " + x);
+ console.error('done ' + x);
if (++responses == total) {
s.on('close', checkFiles);
}
});
}).on('error', function(e) {
- console.error('error! ', e.message)
+ console.error('error! ', e.message);
throw e;
});
})();
@@ -97,7 +97,7 @@ function checkFiles() {
var stat = fs.statSync(common.tmpDir + '/' + fn);
assert.equal(image.length, stat.size,
"size doesn't match on '" + fn +
- "'. Got " + stat.size + " bytes");
+ "'. Got " + stat.size + ' bytes');
}
checkedFiles = true;
diff --git a/test/simple/test-http-head-request.js b/test/simple/test-http-head-request.js
index 09975ca74a..016857f799 100644
--- a/test/simple/test-http-head-request.js
+++ b/test/simple/test-http-head-request.js
@@ -38,9 +38,9 @@ var gotEnd = false;
server.listen(common.PORT, function() {
var request = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'HEAD',
- path: '/'
+ path: '/'
}, function(response) {
common.error('response start');
response.addListener('end', function() {
diff --git a/test/simple/test-http-head-response-has-no-body-end.js b/test/simple/test-http-head-response-has-no-body-end.js
index 2a111e5625..1810f4a2ce 100644
--- a/test/simple/test-http-head-response-has-no-body-end.js
+++ b/test/simple/test-http-head-response-has-no-body-end.js
@@ -41,9 +41,9 @@ var responseComplete = false;
server.addListener('listening', function() {
var req = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'HEAD',
- path: '/'
+ path: '/'
}, function(res) {
common.error('response');
res.addListener('end', function() {
diff --git a/test/simple/test-http-header-read.js b/test/simple/test-http-header-read.js
index 8a6de34094..de20df6044 100644
--- a/test/simple/test-http-header-read.js
+++ b/test/simple/test-http-header-read.js
@@ -35,9 +35,9 @@ var s = http.createServer(function(req, res) {
// This checks that after the headers have been sent, getHeader works
// and does not throw an exception (Issue 752)
assert.doesNotThrow(
- function() {
- assert.equal(plain, res.getHeader(contentType));
- }
+ function() {
+ assert.equal(plain, res.getHeader(contentType));
+ }
);
});
diff --git a/test/simple/test-http-host-headers.js b/test/simple/test-http-host-headers.js
index 8a885d2695..f7818c91d8 100644
--- a/test/simple/test-http-host-headers.js
+++ b/test/simple/test-http-host-headers.js
@@ -153,7 +153,7 @@ function testHttps() {
host: 'localhost',
//agent: false,
port: common.PORT }, cb).on('error', thrower).end();
-
+
https.get({ method: 'GET',
path: '/setHostFalse' + (counter++),
host: 'localhost',
diff --git a/test/simple/test-http-keep-alive-close-on-header.js b/test/simple/test-http-keep-alive-close-on-header.js
index 741f4a517f..ddb2bdbeb5 100644
--- a/test/simple/test-http-keep-alive-close-on-header.js
+++ b/test/simple/test-http-keep-alive-close-on-header.js
@@ -37,37 +37,55 @@ var connectCount = 0;
server.listen(common.PORT, function() {
- var agent = new http.Agent({maxSockets:1})
- var request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function () {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+ var agent = new http.Agent({ maxSockets: 1 });
+ var request = http.request({
+ method: 'GET',
+ path: '/',
+ headers: headers,
+ port: common.PORT,
+ agent: agent
+ }, function() {
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
});
- request.on('socket', function (s) {
- s.on('connect', function () {
+ request.on('socket', function(s) {
+ s.on('connect', function() {
connectCount++;
- })
- })
+ });
+ });
request.end();
-
- request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function () {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+
+ request = http.request({
+ method: 'GET',
+ path: '/',
+ headers: headers,
+ port: common.PORT,
+ agent: agent
+ }, function() {
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
});
- request.on('socket', function (s) {
- s.on('connect', function () {
+ request.on('socket', function(s) {
+ s.on('connect', function() {
connectCount++;
- })
- })
+ });
+ });
request.end();
- request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function(response) {
+ request = http.request({
+ method: 'GET',
+ path: '/',
+ headers: headers,
+ port: common.PORT,
+ agent: agent
+ }, function(response) {
response.addListener('end', function() {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
server.close();
});
});
- request.on('socket', function (s) {
- s.on('connect', function () {
+ request.on('socket', function(s) {
+ s.on('connect', function() {
connectCount++;
- })
- })
+ });
+ });
request.end();
});
diff --git a/test/simple/test-http-keep-alive.js b/test/simple/test-http-keep-alive.js
index 1c5119acfe..5603a0e011 100644
--- a/test/simple/test-http-keep-alive.js
+++ b/test/simple/test-http-keep-alive.js
@@ -36,19 +36,19 @@ var server = http.createServer(function(req, res) {
var connectCount = 0;
server.listen(common.PORT, function() {
- var agent = new http.Agent({maxSockets:1})
- var request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function () {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+ var agent = new http.Agent({maxSockets: 1});
+ var request = http.request({method: 'GET', path: '/', headers: headers, port: common.PORT, agent: agent}, function() {
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
});
request.end();
-
- request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function () {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+
+ request = http.request({method: 'GET', path: '/', headers: headers, port: common.PORT, agent: agent}, function() {
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
});
request.end();
- request = http.request({method:'GET', path:'/', headers:headers, port:common.PORT, agent:agent}, function(response) {
+ request = http.request({method: 'GET', path: '/', headers: headers, port: common.PORT, agent: agent}, function(response) {
response.addListener('end', function() {
- assert.equal(1, agent.sockets['localhost:'+common.PORT].length)
+ assert.equal(1, agent.sockets['localhost:' + common.PORT].length);
server.close();
});
});
diff --git a/test/simple/test-http-many-keep-alive-connections.js b/test/simple/test-http-many-keep-alive-connections.js
index 127ff6d5a3..4714cd523c 100644
--- a/test/simple/test-http-many-keep-alive-connections.js
+++ b/test/simple/test-http-many-keep-alive-connections.js
@@ -32,7 +32,7 @@ var server = http.Server(function(req, res) {
requests++;
assert.equal(req.connection, connection);
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
server.once('connection', function(c) {
diff --git a/test/simple/test-http-multi-line-headers.js b/test/simple/test-http-multi-line-headers.js
index d77d590a4b..a212a04da5 100644
--- a/test/simple/test-http-multi-line-headers.js
+++ b/test/simple/test-http-multi-line-headers.js
@@ -28,17 +28,17 @@ var net = require('net');
var gotResponse = false;
var server = net.createServer(function(conn) {
- var body = "Yet another node.js server.";
+ var body = 'Yet another node.js server.';
var response =
- "HTTP/1.1 200 OK\r\n" +
- "Connection: close\r\n" +
- "Content-Length: " + body.length + "\r\n" +
- "Content-Type: text/plain;\r\n" +
- " x-unix-mode=0600;\r\n" +
- " name=\"hello.txt\"\r\n" +
- "\r\n" +
- body;
+ 'HTTP/1.1 200 OK\r\n' +
+ 'Connection: close\r\n' +
+ 'Content-Length: ' + body.length + '\r\n' +
+ 'Content-Type: text/plain;\r\n' +
+ ' x-unix-mode=0600;\r\n' +
+ ' name=\"hello.txt\"\r\n' +
+ '\r\n' +
+ body;
conn.write(response, function() {
conn.destroy();
@@ -47,7 +47,7 @@ var server = net.createServer(function(conn) {
});
server.listen(common.PORT, function() {
- http.get({host:'127.0.0.1', port:common.PORT}, function(res) {
+ http.get({host: '127.0.0.1', port: common.PORT}, function(res) {
assert.equal(res.headers['content-type'],
'text/plain;x-unix-mode=0600;name="hello.txt"');
gotResponse = true;
diff --git a/test/simple/test-http-mutable-headers.js b/test/simple/test-http-mutable-headers.js
index 947399981d..6106ac6ee0 100644
--- a/test/simple/test-http-mutable-headers.js
+++ b/test/simple/test-http-mutable-headers.js
@@ -42,10 +42,10 @@ var cookies = [
var s = http.createServer(function(req, res) {
switch (test) {
case 'headers':
- assert.throws(function () { res.setHeader() });
- assert.throws(function () { res.setHeader('someHeader') });
- assert.throws(function () { res.getHeader() });
- assert.throws(function () { res.removeHeader() });
+ assert.throws(function() { res.setHeader() });
+ assert.throws(function() { res.setHeader('someHeader') });
+ assert.throws(function() { res.getHeader() });
+ assert.throws(function() { res.removeHeader() });
res.setHeader('x-test-header', 'testing');
res.setHeader('X-TEST-HEADER2', 'testing');
@@ -84,7 +84,7 @@ var s = http.createServer(function(req, res) {
s.listen(common.PORT, nextTest);
-function nextTest () {
+function nextTest() {
if (test === 'end') {
return s.close();
}
@@ -103,7 +103,7 @@ function nextTest () {
assert.equal(response.headers['x-test-header'],
'testing');
assert.equal(response.headers['x-test-array-header'],
- [1,2,3].join(', '));
+ [1, 2, 3].join(', '));
assert.deepEqual(cookies,
response.headers['set-cookie']);
assert.equal(response.headers['x-test-header2'] !== undefined, false);
@@ -130,7 +130,7 @@ function nextTest () {
break;
default:
- throw Error("?");
+ throw Error('?');
}
response.setEncoding('utf8');
diff --git a/test/simple/test-http-request-end-twice.js b/test/simple/test-http-request-end-twice.js
index dce95071f7..764f36e139 100644
--- a/test/simple/test-http-request-end-twice.js
+++ b/test/simple/test-http-request-end-twice.js
@@ -28,7 +28,7 @@ var http = require('http');
var server = http.Server(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end("hello world\n");
+ res.end('hello world\n');
});
server.listen(common.PORT, function() {
var req = http.get({port: common.PORT}, function(res) {
diff --git a/test/simple/test-http-request-end.js b/test/simple/test-http-request-end.js
index a24c316555..f5da0faf2e 100644
--- a/test/simple/test-http-request-end.js
+++ b/test/simple/test-http-request-end.js
@@ -37,7 +37,7 @@ var server = http.Server(function(req, res) {
});
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
server.listen(common.PORT, function() {
diff --git a/test/simple/test-http-response-close.js b/test/simple/test-http-response-close.js
index 438bdc4b2d..94b8a9ccfa 100644
--- a/test/simple/test-http-response-close.js
+++ b/test/simple/test-http-response-close.js
@@ -30,20 +30,20 @@ var server = http.createServer(function(req, res) {
res.write('a');
req.on('close', function() {
- console.error("aborted");
+ console.error('aborted');
gotEnd = true;
});
});
server.listen(common.PORT);
server.addListener('listening', function() {
- console.error("make req");
+ console.error('make req');
http.get({
port: common.PORT
}, function(res) {
- console.error("got res");
+ console.error('got res');
res.on('data', function(data) {
- console.error("destroy res");
+ console.error('destroy res');
res.destroy();
server.close();
});
diff --git a/test/simple/test-http-set-timeout.js b/test/simple/test-http-set-timeout.js
index 05b7d094a8..0665aa4b40 100644
--- a/test/simple/test-http-set-timeout.js
+++ b/test/simple/test-http-set-timeout.js
@@ -41,11 +41,11 @@ server.listen(common.PORT, function() {
throw new Error('Timeout was not sucessful');
}, 2000);
- var x = http.get({port:common.PORT, path:'/'});
- x.on('error', function () {
+ var x = http.get({port: common.PORT, path: '/'});
+ x.on('error', function() {
clearTimeout(errorTimer);
console.log('HTTP REQUEST COMPLETE (this is good)');
- })
+ });
x.end();
});
diff --git a/test/simple/test-http-status-code.js b/test/simple/test-http-status-code.js
index 3c8b4fed09..a692b1f802 100644
--- a/test/simple/test-http-status-code.js
+++ b/test/simple/test-http-status-code.js
@@ -36,7 +36,7 @@ var testIdx = 0;
var s = http.createServer(function(req, res) {
var t = tests[testIdx];
res.writeHead(t, {'Content-Type': 'text/plain'});
- console.log('--\nserver: statusCode after writeHead: '+res.statusCode);
+ console.log('--\nserver: statusCode after writeHead: ' + res.statusCode);
assert.equal(res.statusCode, t);
res.end('hello world\n');
});
@@ -44,7 +44,7 @@ var s = http.createServer(function(req, res) {
s.listen(common.PORT, nextTest);
-function nextTest () {
+function nextTest() {
if (testIdx + 1 === tests.length) {
return s.close();
}
diff --git a/test/simple/test-http-unix-socket.js b/test/simple/test-http-unix-socket.js
index 857ef6e32b..01c29c113b 100644
--- a/test/simple/test-http-unix-socket.js
+++ b/test/simple/test-http-unix-socket.js
@@ -24,14 +24,15 @@ var assert = require('assert');
var fs = require('fs');
var http = require('http');
-var status_ok = false; // status code == 200?
+var status_ok = false; // status code == 200?
var headers_ok = false;
-var body_ok = false;
+var body_ok = false;
var server = http.createServer(function(req, res) {
- res.writeHead(200, {'Content-Type': 'text/plain',
- 'Connection': 'close'
- });
+ res.writeHead(200, {
+ 'Content-Type': 'text/plain',
+ 'Connection': 'close'
+ });
res.write('hello ');
res.write('world\n');
res.end();
@@ -54,7 +55,7 @@ server.listen(common.PIPE, function() {
res.body = '';
res.setEncoding('utf8');
- res.on('data', function (chunk) {
+ res.on('data', function(chunk) {
res.body += chunk;
});
diff --git a/test/simple/test-http-upgrade-agent.js b/test/simple/test-http-upgrade-agent.js
index ec83ddffaa..d75fb2e6a5 100644
--- a/test/simple/test-http-upgrade-agent.js
+++ b/test/simple/test-http-upgrade-agent.js
@@ -73,16 +73,16 @@ srv.listen(common.PORT, '127.0.0.1', function() {
'connection': 'upgrade',
'upgrade': 'websocket' };
assert.deepEqual(expectedHeaders, res.headers);
- assert.equal(http.globalAgent.sockets[options.host+':'+options.port].length, 1);
-
- process.nextTick(function () {
+ assert.equal(http.globalAgent.sockets[options.host + ':' + options.port].length, 1);
+
+ process.nextTick(function() {
// Make sure this request got removed from the pool.
- assert.equal(http.globalAgent.sockets[options.host+':'+options.port].length, 0);
+ assert.equal(http.globalAgent.sockets[options.host + ':' + options.port].length, 0);
socket.end();
srv.close();
-
+
gotUpgrade = true;
- })
+ });
});
});
diff --git a/test/simple/test-http-upgrade-client2.js b/test/simple/test-http-upgrade-client2.js
index 080bbcc7eb..fa39f2a572 100644
--- a/test/simple/test-http-upgrade-client2.js
+++ b/test/simple/test-http-upgrade-client2.js
@@ -40,13 +40,13 @@ var successCount = 0;
server.listen(common.PORT, function() {
function upgradeRequest(fn) {
- console.log("req");
+ console.log('req');
var header = { 'Connection': 'Upgrade', 'Upgrade': 'Test' };
var request = http.request({ port: common.PORT, headers: header });
var wasUpgrade = false;
function onUpgrade(res, socket, head) {
- console.log("client upgraded");
+ console.log('client upgraded');
wasUpgrade = true;
request.removeListener('upgrade', onUpgrade);
@@ -55,7 +55,7 @@ server.listen(common.PORT, function() {
request.on('upgrade', onUpgrade);
function onEnd() {
- console.log("client end");
+ console.log('client end');
request.removeListener('end', onEnd);
if (!wasUpgrade) {
throw new Error('hasn\'t received upgrade event');
diff --git a/test/simple/test-http.js b/test/simple/test-http.js
index 2c4f19c8dd..3c3fd05cc6 100644
--- a/test/simple/test-http.js
+++ b/test/simple/test-http.js
@@ -82,8 +82,8 @@ server.addListener('listening', function() {
var req = http.request({
port: common.PORT,
method: 'POST',
- path: '/world',
- agent: agent
+ path: '/world',
+ agent: agent
}, function(res) {
assert.equal(200, res.statusCode);
responses_recvd += 1;
diff --git a/test/simple/test-https-agent.js b/test/simple/test-https-agent.js
index ccbd40fca9..0a117edce8 100644
--- a/test/simple/test-https-agent.js
+++ b/test/simple/test-https-agent.js
@@ -23,7 +23,7 @@
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -40,7 +40,7 @@ var options = {
var server = https.Server(options, function(req, res) {
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
@@ -50,9 +50,9 @@ var M = 10;
server.listen(common.PORT, function() {
for (var i = 0; i < N; i++) {
- setTimeout(function () {
+ setTimeout(function() {
for (var j = 0; j < M; j++) {
- https.get({ port: common.PORT, path: '/', }, function(res) {
+ https.get({ port: common.PORT, path: '/' }, function(res) {
console.log(res.statusCode);
if (++responses == N * M) server.close();
}).on('error', function(e) {
diff --git a/test/simple/test-https-connecting-to-http.js b/test/simple/test-https-connecting-to-http.js
index 1ee969f646..0012f47492 100644
--- a/test/simple/test-https-connecting-to-http.js
+++ b/test/simple/test-https-connecting-to-http.js
@@ -36,7 +36,7 @@ var reqErrorCount = 0;
var body = 'hello world\n';
-var server = http.createServer(function (req, res) {
+var server = http.createServer(function(req, res) {
reqCount++;
console.log('got request');
res.writeHead(200, { 'content-type': 'text/plain' });
diff --git a/test/simple/test-https-eof-for-eom.js b/test/simple/test-https-eof-for-eom.js
index 3e09c0bfd7..39ae371dbb 100644
--- a/test/simple/test-https-eof-for-eom.js
+++ b/test/simple/test-https-eof-for-eom.js
@@ -73,7 +73,7 @@ var gotEnd = false;
var bodyBuffer = '';
server.listen(common.PORT, function() {
- console.log('1) Making Request');
+ console.log('1) Making Request');
var req = https.get({ port: common.PORT }, function(res) {
server.close();
console.log('3) Client got response headers.');
diff --git a/test/simple/test-https-foafssl.js b/test/simple/test-https-foafssl.js
index 73ec565321..2336e5cd41 100644
--- a/test/simple/test-https-foafssl.js
+++ b/test/simple/test-https-foafssl.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -46,9 +46,9 @@ var subjectaltname;
var modulus;
var exponent;
-var server = https.createServer(options, function (req, res) {
+var server = https.createServer(options, function(req, res) {
reqCount++;
- console.log("got request");
+ console.log('got request');
cert = req.connection.getPeerCertificate();
@@ -58,14 +58,14 @@ var server = https.createServer(options, function (req, res) {
res.writeHead(200, { 'content-type': 'text/plain' });
res.end(body);
-})
+});
-server.listen(common.PORT, function () {
- var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/';
- cmd += ' --cert '+join(common.fixturesDir, 'foafssl.crt');
- cmd += ' --key '+join(common.fixturesDir, 'foafssl.key');
- console.error("executing %j", cmd);
+server.listen(common.PORT, function() {
+ var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/';
+ cmd += ' --cert ' + join(common.fixturesDir, 'foafssl.crt');
+ cmd += ' --key ' + join(common.fixturesDir, 'foafssl.key');
+ console.error('executing %j', cmd);
exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
common.error(common.inspect(stdout));
@@ -75,14 +75,15 @@ server.listen(common.PORT, function () {
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(subjectaltname, 'URI:http://example.com/#me');
- assert.equal(modulus, 'A6F44A9C25791431214F5C87AF9E040177A8BB89AC803F7E09BBC\
-3A5519F349CD9B9C40BE436D0AA823A94147E26C89248ADA2BE3DD4D34E8C28964694B2047D217\
-B4F1299371EA93A83C89AB9440724131E65F2B0161DE9560CDE9C13455552B2F49CF0FB00D8D77\
-532324913F6F80FF29D0A131D29DB06AFF8BE191B7920DC2DAE1C26EA82A47847A10391EF3BF6A\
-ABB3CC40FF82100B03A4F0FF1809278E4DDFDA7DE954ED56DC7AD9A47EEBC37D771A366FC60A5B\
-CB72373BEC180649B3EFA0E9092707210B41B90032BB18BC91F2046EBDAF1191F4A4E26D71879C\
-4C7867B62FCD508E8CE66E82D128A71E915809FCF44E8DE774067F1DE5D70B9C03687');
+ assert.equal(modulus, 'A6F44A9C25791431214F5C87AF9E040177A8BB89AC803F7E09' +
+ 'BBC3A5519F349CD9B9C40BE436D0AA823A94147E26C89248ADA2BE3DD4D34E8C2896' +
+ '4694B2047D217B4F1299371EA93A83C89AB9440724131E65F2B0161DE9560CDE9C13' +
+ '455552B2F49CF0FB00D8D77532324913F6F80FF29D0A131D29DB06AFF8BE191B7920' +
+ 'DC2DAE1C26EA82A47847A10391EF3BF6AABB3CC40FF82100B03A4F0FF1809278E4DD' +
+ 'FDA7DE954ED56DC7AD9A47EEBC37D771A366FC60A5BCB72373BEC180649B3EFA0E90' +
+ '92707210B41B90032BB18BC91F2046EBDAF1191F4A4E26D71879C4C7867B62FCD508' +
+ 'E8CE66E82D128A71E915809FCF44E8DE774067F1DE5D70B9C03687');
assert.equal(exponent, '10001');
});
diff --git a/test/simple/test-https-simple.js b/test/simple/test-https-simple.js
index b054b8eef5..9be7c62e43 100644
--- a/test/simple/test-https-simple.js
+++ b/test/simple/test-https-simple.js
@@ -23,7 +23,7 @@
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -43,17 +43,17 @@ var options = {
var reqCount = 0;
var body = 'hello world\n';
-var server = https.createServer(options, function (req, res) {
+var server = https.createServer(options, function(req, res) {
reqCount++;
- console.log("got request");
+ console.log('got request');
res.writeHead(200, { 'content-type': 'text/plain' });
res.end(body);
-})
+});
-server.listen(common.PORT, function () {
- var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/';
- console.error("executing %j", cmd);
+server.listen(common.PORT, function() {
+ var cmd = 'curl --insecure https://127.0.0.1:' + common.PORT + '/';
+ console.error('executing %j', cmd);
exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
common.error(common.inspect(stdout));
@@ -61,8 +61,8 @@ server.listen(common.PORT, function () {
// Do the same thing now without --insecure
// The connection should not be accepted.
- var cmd = 'curl https://127.0.0.1:' + common.PORT + '/';
- console.error("executing %j", cmd);
+ var cmd = 'curl https://127.0.0.1:' + common.PORT + '/';
+ console.error('executing %j', cmd);
exec(cmd, function(err, stdout, stderr) {
assert.ok(err);
server.close();
@@ -70,6 +70,6 @@ server.listen(common.PORT, function () {
});
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(1, reqCount);
});
diff --git a/test/simple/test-init.js b/test/simple/test-init.js
index f5a45fab28..032b307ea3 100644
--- a/test/simple/test-init.js
+++ b/test/simple/test-init.js
@@ -24,8 +24,8 @@
(function() {
var assert = require('assert'),
- child = require('child_process'),
- util = require('util'),
+ child = require('child_process'),
+ util = require('util'),
common = require('../common');
if (process.env['TEST_INIT']) {
util.print('Loaded successfully!');
@@ -34,30 +34,30 @@
// being in the test folder
process.chdir(__dirname);
- child.exec(process.execPath + ' test-init',{env:{'TEST_INIT':1}},
- function(err, stdout, stderr) {
- assert.equal(stdout, 'Loaded successfully!', '`node test-init` failed!');
- });
- child.exec(process.execPath + ' test-init.js', {env:{'TEST_INIT':1}},
- function(err, stdout, stderr) {
- assert.equal(stdout, 'Loaded successfully!', '`node test-init.js` failed!');
- });
+ child.exec(process.execPath + ' test-init', {env: {'TEST_INIT': 1}},
+ function(err, stdout, stderr) {
+ assert.equal(stdout, 'Loaded successfully!', '`node test-init` failed!');
+ });
+ child.exec(process.execPath + ' test-init.js', {env: {'TEST_INIT': 1}},
+ function(err, stdout, stderr) {
+ assert.equal(stdout, 'Loaded successfully!', '`node test-init.js` failed!');
+ });
// test-init-index is in fixtures dir as requested by ry, so go there
process.chdir(common.fixturesDir);
- child.exec(process.execPath + ' test-init-index',{env:{'TEST_INIT':1}},
- function(err, stdout, stderr) {
- assert.equal(stdout, 'Loaded successfully!', '`node test-init-index failed!');
- });
+ child.exec(process.execPath + ' test-init-index', {env: {'TEST_INIT': 1}},
+ function(err, stdout, stderr) {
+ assert.equal(stdout, 'Loaded successfully!', '`node test-init-index failed!');
+ });
// ensures that `node fs` does not mistakenly load the native 'fs' module
// instead of the desired file and that the fs module loads as expected in node
process.chdir(common.fixturesDir + '/test-init-native/');
- child.exec(process.execPath + ' fs', {env:{'TEST_INIT':1}},
- function(err, stdout, stderr) {
- assert.equal(stdout, 'fs loaded successfully', '`node fs` failed!');
- });
+ child.exec(process.execPath + ' fs', {env: {'TEST_INIT': 1}},
+ function(err, stdout, stderr) {
+ assert.equal(stdout, 'fs loaded successfully', '`node fs` failed!');
+ });
}
})();
diff --git a/test/simple/test-module-load-list.js b/test/simple/test-module-load-list.js
index 92f335b901..b57795ef79 100644
--- a/test/simple/test-module-load-list.js
+++ b/test/simple/test-module-load-list.js
@@ -55,10 +55,10 @@ checkExpected();
// Now do the test again after we console.log something.
-console.log("load console.log. process.stdout._type is " +
+console.log('load console.log. process.stdout._type is ' +
process.stdout._type);
-if (!process.features.uv) {
+if (!process.features.uv) {
// legacy
expected = expected.concat([
'NativeModule console',
@@ -78,7 +78,7 @@ if (!process.features.uv) {
case 'fs':
expected = expected.concat([
'NativeModule console',
- 'Binding tty_wrap',
+ 'Binding tty_wrap'
]);
break;
@@ -102,17 +102,17 @@ if (!process.features.uv) {
'NativeModule timers_uv',
'Binding timer_wrap',
'NativeModule _linklist',
- 'Binding pipe_wrap',
+ 'Binding pipe_wrap'
]);
break;
default:
- assert.ok(0, "prcoess.stdout._type is bad");
+ assert.ok(0, 'prcoess.stdout._type is bad');
}
}
-console.error("process.moduleLoadList", process.moduleLoadList)
-console.error("expected", expected)
+console.error('process.moduleLoadList', process.moduleLoadList);
+console.error('expected', expected);
checkExpected();
diff --git a/test/simple/test-module-loading.js b/test/simple/test-module-loading.js
index a5e0acf3af..d6af3b157c 100644
--- a/test/simple/test-module-loading.js
+++ b/test/simple/test-module-loading.js
@@ -199,9 +199,11 @@ assert.equal(child.loaded, parent.loaded);
// #1357 Loading JSON files with require()
var json = require('../fixtures/packages/main/package.json');
-assert.deepEqual(json, { name: 'package-name',
- version: '1.2.3',
- main: 'package-main-module' });
+assert.deepEqual(json, {
+ name: 'package-name',
+ version: '1.2.3',
+ main: 'package-main-module'
+});
process.addListener('exit', function() {
diff --git a/test/simple/test-net-bytes-stats.js b/test/simple/test-net-bytes-stats.js
index 639a401519..46a927c880 100644
--- a/test/simple/test-net-bytes-stats.js
+++ b/test/simple/test-net-bytes-stats.js
@@ -40,14 +40,14 @@ var tcp = net.Server(function(s) {
});
});
-tcp.listen(common.PORT, function () {
+tcp.listen(common.PORT, function() {
var socket = net.createConnection(tcpPort);
socket.on('connect', function() {
count++;
console.log('tcp client connection #' + count);
- socket.write('foo', function () {
+ socket.write('foo', function() {
socket.end('bar');
});
});
@@ -64,11 +64,11 @@ tcp.listen(common.PORT, function () {
socket.connect(tcpPort);
} else {
tcp.close();
- };
+ }
});
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(bytesRead, 12);
assert.equal(bytesWritten, 12);
});
diff --git a/test/simple/test-net-connect-buffer.js b/test/simple/test-net-connect-buffer.js
index 8cda2fb41c..2764e5c9c6 100644
--- a/test/simple/test-net-connect-buffer.js
+++ b/test/simple/test-net-connect-buffer.js
@@ -49,7 +49,7 @@ var tcp = net.Server(function(s) {
});
});
-tcp.listen(common.PORT, function () {
+tcp.listen(common.PORT, function() {
var socket = net.Stream();
console.log('Connecting to socket ');
@@ -63,10 +63,10 @@ tcp.listen(common.PORT, function () {
assert.equal('opening', socket.readyState);
- var r = socket.write('foo', function () {
+ var r = socket.write('foo', function() {
fooWritten = true;
assert.ok(connectHappened);
- console.error("foo written");
+ console.error('foo written');
});
assert.equal(false, r);
@@ -75,7 +75,7 @@ tcp.listen(common.PORT, function () {
assert.equal('opening', socket.readyState);
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.ok(connectHappened);
assert.ok(fooWritten);
});
diff --git a/test/simple/test-net-connect-timeout.js b/test/simple/test-net-connect-timeout.js
index 33a45a0908..a5a11a8b0a 100644
--- a/test/simple/test-net-connect-timeout.js
+++ b/test/simple/test-net-connect-timeout.js
@@ -47,7 +47,7 @@ var socket0 = net.createConnection(9999, 'google.com');
socket0.setTimeout(T);
socket0.on('timeout', function() {
- console.error("timeout");
+ console.error('timeout');
gotTimeout0 = true;
var now = new Date();
assert.ok(now - start < T + 500);
@@ -55,7 +55,7 @@ socket0.on('timeout', function() {
});
socket0.on('connect', function() {
- console.error("connect");
+ console.error('connect');
gotConnect0 = true;
socket0.destroy();
});
@@ -68,7 +68,7 @@ var socket1 = net.createConnection(9999, '24.24.24.24');
socket1.setTimeout(T);
socket1.on('timeout', function() {
- console.error("timeout");
+ console.error('timeout');
gotTimeout1 = true;
var now = new Date();
assert.ok(now - start < T + 500);
@@ -76,7 +76,7 @@ socket1.on('timeout', function() {
});
socket1.on('connect', function() {
- console.error("connect");
+ console.error('connect');
gotConnect1 = true;
socket1.destroy();
});
diff --git a/test/simple/test-net-create-connection.js b/test/simple/test-net-create-connection.js
index 1d6cbd50d4..c21be152c0 100644
--- a/test/simple/test-net-create-connection.js
+++ b/test/simple/test-net-create-connection.js
@@ -44,7 +44,7 @@ server.listen(tcpPort, 'localhost', function() {
net.createConnection(tcpPort, 'localhost', cb);
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(clientConnected, 4);
});
diff --git a/test/simple/test-net-pingpong.js b/test/simple/test-net-pingpong.js
index d90073f9e9..4f512c449f 100644
--- a/test/simple/test-net-pingpong.js
+++ b/test/simple/test-net-pingpong.js
@@ -52,7 +52,7 @@ function pingPongTest(port, host) {
assert.equal(true, socket.readable);
assert.equal(true, count <= N);
if (/PING/.exec(data)) {
- socket.write('PONG', function () {
+ socket.write('PONG', function() {
sentPongs++;
console.error('sent PONG');
});
@@ -134,7 +134,7 @@ pingPongTest(20988);
pingPongTest(20989, 'localhost');
pingPongTest(20997, '::1');
-process.addListener('exit', function () {
+process.addListener('exit', function() {
assert.equal(4, tests_run);
console.log('done');
});
diff --git a/test/simple/test-net-server-try-ports.js b/test/simple/test-net-server-try-ports.js
index 6dc8ee5361..5eca9d0957 100644
--- a/test/simple/test-net-server-try-ports.js
+++ b/test/simple/test-net-server-try-ports.js
@@ -30,12 +30,12 @@ var connections = 0;
var server1listening = false;
var server2listening = false;
-var server1 = net.Server(function (socket) {
+var server1 = net.Server(function(socket) {
connections++;
socket.destroy();
});
-var server2 = net.Server(function (socket) {
+var server2 = net.Server(function(socket) {
connections++;
socket.destroy();
});
@@ -43,12 +43,12 @@ var server2 = net.Server(function (socket) {
var server2errors = 0;
server2.on('error', function() {
server2errors++;
- console.error("server2 error");
+ console.error('server2 error');
});
-server1.listen(common.PORT, function () {
- console.error("server1 listening");
+server1.listen(common.PORT, function() {
+ console.error('server1 listening');
server1listening = true;
// This should make server2 emit EADDRINUSE
server2.listen(common.PORT);
@@ -58,8 +58,8 @@ server1.listen(common.PORT, function () {
// Then we could avoid this very unlikely but potential race condition
// here.
setTimeout(function() {
- server2.listen(common.PORT + 1, function () {
- console.error("server2 listening");
+ server2.listen(common.PORT + 1, function() {
+ console.error('server2 listening');
server2listening = true;
server1.close();
diff --git a/test/simple/test-net-stream.js b/test/simple/test-net-stream.js
index a3b5afecf4..429995ab93 100644
--- a/test/simple/test-net-stream.js
+++ b/test/simple/test-net-stream.js
@@ -33,7 +33,7 @@ s.server = new net.Server();
s.server.connections = 10;
assert.equal(10, s.server.connections);
-s.destroy()
+s.destroy();
assert.equal(9, s.server.connections);
-s.destroy()
+s.destroy();
assert.equal(9, s.server.connections);
diff --git a/test/simple/test-os.js b/test/simple/test-os.js
index b4f97c13db..225351ac88 100644
--- a/test/simple/test-os.js
+++ b/test/simple/test-os.js
@@ -27,32 +27,32 @@ var assert = require('assert');
var os = require('os');
-var hostname = os.hostname()
-console.log("hostname = %s", hostname);
+var hostname = os.hostname();
+console.log('hostname = %s', hostname);
assert.ok(hostname.length > 0);
var uptime = os.uptime();
-console.log("uptime = %d", uptime);
+console.log('uptime = %d', uptime);
assert.ok(uptime > 0);
var cpus = os.cpus();
-console.log("cpus = ", cpus);
+console.log('cpus = ', cpus);
assert.ok(cpus.length > 0);
var type = os.type();
-console.log("type = ", type);
+console.log('type = ', type);
assert.ok(type.length > 0);
var release = os.release();
-console.log("release = ", release);
+console.log('release = ', release);
assert.ok(release.length > 0);
var platform = os.platform();
-console.log("platform = ", platform);
+console.log('platform = ', platform);
assert.ok(platform.length > 0);
var arch = os.arch();
-console.log("arch = ", arch);
+console.log('arch = ', arch);
assert.ok(arch.length > 0);
if (process.platform != 'sunos') {
diff --git a/test/simple/test-path.js b/test/simple/test-path.js
index 7fe80ecd53..e16b459d92 100644
--- a/test/simple/test-path.js
+++ b/test/simple/test-path.js
@@ -180,24 +180,24 @@ if (isWindows) {
if (isWindows) {
// windows
var resolveTests =
- // arguments result
- [[['c:/blah\\blah', 'd:/games', 'c:../a' ], 'c:\\blah\\a' ],
- [['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe' ], 'd:\\e.exe' ],
- [['c:/ignore', 'c:/some/file' ], 'c:\\some\\file' ],
- [['d:/ignore', 'd:some/dir//' ], 'd:\\ignore\\some\\dir' ],
- [['.' ], process.cwd() ],
- [['//server/share', '..', 'relative\\' ], '\\\\server\\share\\relative' ]];
+ // arguments result
+ [[['c:/blah\\blah', 'd:/games', 'c:../a'], 'c:\\blah\\a'],
+ [['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'],
+ [['c:/ignore', 'c:/some/file'], 'c:\\some\\file'],
+ [['d:/ignore', 'd:some/dir//'], 'd:\\ignore\\some\\dir'],
+ [['.'], process.cwd()],
+ [['//server/share', '..', 'relative\\'], '\\\\server\\share\\relative']];
} else {
// Posix
var resolveTests =
- // arguments result
- [[['/var/lib', '../', 'file/' ], '/var/file' ],
- [['/var/lib', '/../', 'file/' ], '/file' ],
- [['a/b/c/', '../../..' ], process.cwd() ],
- [['.' ], process.cwd() ],
- [['/some/dir', '.', '/absolute/' ], '/absolute' ]];
+ // arguments result
+ [[['/var/lib', '../', 'file/'], '/var/file'],
+ [['/var/lib', '/../', 'file/'], '/file'],
+ [['a/b/c/', '../../..'], process.cwd()],
+ [['.'], process.cwd()],
+ [['/some/dir', '.', '/absolute/'], '/absolute']];
}
-var failures = []
+var failures = [];
resolveTests.forEach(function(test) {
var actual = path.resolve.apply(path, test[0]);
var expected = test[1];
@@ -213,25 +213,25 @@ assert.equal(failures.length, 0, failures.join(''));
if (isWindows) {
// windows
var relativeTests =
- // arguments result
- [['c:/blah\\blah', 'd:/games', 'd:\\games'],
- ['c:/aaaa/bbbb', 'c:/aaaa', '..'],
- ['c:/aaaa/bbbb', 'c:/cccc', '..\\..\\cccc'],
- ['c:/aaaa/bbbb', 'c:/aaaa/bbbb',''],
- ['c:/aaaa/bbbb', 'c:/aaaa/cccc','..\\cccc'],
- ['c:/aaaa/', 'c:/aaaa/cccc', 'cccc'],
- ['c:/', 'c:\\aaaa\\bbbb', 'aaaa\\bbbb'],
- ['c:/aaaa/bbbb', 'd:\\', 'd:\\']];
+ // arguments result
+ [['c:/blah\\blah', 'd:/games', 'd:\\games'],
+ ['c:/aaaa/bbbb', 'c:/aaaa', '..'],
+ ['c:/aaaa/bbbb', 'c:/cccc', '..\\..\\cccc'],
+ ['c:/aaaa/bbbb', 'c:/aaaa/bbbb', ''],
+ ['c:/aaaa/bbbb', 'c:/aaaa/cccc', '..\\cccc'],
+ ['c:/aaaa/', 'c:/aaaa/cccc', 'cccc'],
+ ['c:/', 'c:\\aaaa\\bbbb', 'aaaa\\bbbb'],
+ ['c:/aaaa/bbbb', 'd:\\', 'd:\\']];
} else {
// posix
var relativeTests =
- // arguments result
- [['/var/lib', '/var', '..'],
- ['/var/lib', '/bin', '../../bin'],
- ['/var/lib', '/var/lib', ''],
- ['/var/lib', '/var/apache', '../apache'],
- ['/var/', '/var/lib', 'lib'],
- ['/', '/var/lib', 'var/lib']];
+ // arguments result
+ [['/var/lib', '/var', '..'],
+ ['/var/lib', '/bin', '../../bin'],
+ ['/var/lib', '/var/lib', ''],
+ ['/var/lib', '/var/apache', '../apache'],
+ ['/var/', '/var/lib', 'lib'],
+ ['/', '/var/lib', 'var/lib']];
}
var failures = [];
relativeTests.forEach(function(test) {
diff --git a/test/simple/test-pipe-file-to-http.js b/test/simple/test-pipe-file-to-http.js
index ed93233613..99fad6ebb6 100644
--- a/test/simple/test-pipe-file-to-http.js
+++ b/test/simple/test-pipe-file-to-http.js
@@ -59,7 +59,7 @@ server.listen(common.PORT);
server.on('listening', function() {
var cmd = common.ddCommand(filename, 10240);
- console.log("dd command: ", cmd);
+ console.log('dd command: ', cmd);
cp.exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
diff --git a/test/simple/test-pipe-stream.js b/test/simple/test-pipe-stream.js
index 8ed87fd404..b2b2a55184 100644
--- a/test/simple/test-pipe-stream.js
+++ b/test/simple/test-pipe-stream.js
@@ -44,7 +44,7 @@ function test(clazz, cb) {
});
conn.on('data', function(data) {
- assert.equal(data.toString(), 'PONG')
+ assert.equal(data.toString(), 'PONG');
have_pong = true;
conn.destroy();
});
@@ -56,7 +56,7 @@ function test(clazz, cb) {
});
conn.on('data', function(data) {
- assert.equal(data.toString(), 'PING')
+ assert.equal(data.toString(), 'PING');
have_ping = true;
conn.write('PONG', 'utf-8');
});
@@ -82,4 +82,5 @@ function test(clazz, cb) {
test(net.Stream, function() {
test(net.Socket);
-}); \ No newline at end of file
+});
+
diff --git a/test/simple/test-pipe.js b/test/simple/test-pipe.js
index de89b0d2bb..0dce258f99 100644
--- a/test/simple/test-pipe.js
+++ b/test/simple/test-pipe.js
@@ -111,9 +111,9 @@ function startClient() {
console.log('Making request');
var req = http.request({
- port: common.PORT,
- method: 'GET',
- path: '/',
+ port: common.PORT,
+ method: 'GET',
+ path: '/',
headers: { 'content-length': buffer.length }
}, function(res) {
console.log('Got response');
diff --git a/test/simple/test-process-env.js b/test/simple/test-process-env.js
index 0001fb3e20..fb4a35b63d 100644
--- a/test/simple/test-process-env.js
+++ b/test/simple/test-process-env.js
@@ -29,7 +29,7 @@ spawn = require('child_process').spawn;
* environment variables. The problem is that various V8 platform backends
* deal with timezone in different ways. The windows platform backend caches
* the timezone value while the Linux one hits libc for every query.
-
+
https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-linux.cc#L339-345
https://github.com/joyent/node/blob/08782931205bc4f6d28102ebc29fd806e8ccdf1f/deps/v8/src/platform-win32.cc#L590-596
diff --git a/test/simple/test-process-kill-null.js b/test/simple/test-process-kill-null.js
index b29fa7597c..54caca2a6c 100644
--- a/test/simple/test-process-kill-null.js
+++ b/test/simple/test-process-kill-null.js
@@ -31,7 +31,7 @@ var called;
process.kill(cat.pid, 0);
-cat.stdout.on('data', function(){
+cat.stdout.on('data', function() {
called = true;
process.kill(cat.pid, 'SIGKILL');
});
@@ -39,6 +39,6 @@ cat.stdout.on('data', function(){
// EPIPE when null sig fails
cat.stdin.write('test');
-process.on('exit', function(){
+process.on('exit', function() {
assert.ok(called);
});
diff --git a/test/simple/test-process-wrap.js b/test/simple/test-process-wrap.js
index e6a9e4ebad..e3929ae5b7 100644
--- a/test/simple/test-process-wrap.js
+++ b/test/simple/test-process-wrap.js
@@ -34,7 +34,7 @@ var gotPipeEOF = false;
var gotPipeData = false;
p.onexit = function(exitCode, signal) {
- console.log("exit");
+ console.log('exit');
p.close();
pipe.readStart();
@@ -42,22 +42,22 @@ p.onexit = function(exitCode, signal) {
assert.equal(0, signal);
processExited = true;
-}
+};
pipe.onread = function(b, off, len) {
assert.ok(processExited);
if (b) {
gotPipeData = true;
- console.log("read %d", len);
+ console.log('read %d', len);
} else {
gotPipeEOF = true;
pipe.close();
}
-}
+};
p.spawn({
file: process.execPath,
- args: [ process.execPath, "-v" ],
+ args: [process.execPath, '-v'],
stdoutStream: pipe
});
diff --git a/test/simple/test-querystring.js b/test/simple/test-querystring.js
index 0900c3387a..de0d63102a 100644
--- a/test/simple/test-querystring.js
+++ b/test/simple/test-querystring.js
@@ -50,12 +50,12 @@ var qsTestCases = [
['foo=%zx', 'foo=%25zx', {'foo': '%zx'}],
['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }],
// See: https://github.com/joyent/node/issues/1707
- [ 'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
+ ['hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
{ hasOwnProperty: 'x',
toString: 'foo',
valueOf: 'bar',
- __defineGetter__: 'baz' } ]
+ __defineGetter__: 'baz' }]
];
// [ wonkyQS, canonicalQS, obj ]
diff --git a/test/simple/test-readdouble.js b/test/simple/test-readdouble.js
index a6438b9c75..9008f8673c 100644
--- a/test/simple/test-readdouble.js
+++ b/test/simple/test-readdouble.js
@@ -85,12 +85,12 @@ function test() {
buffer[6] = 0;
ASSERT.equal(0, buffer.readDoubleBE(0));
ASSERT.equal(0, buffer.readDoubleLE(0));
- ASSERT.equal(false, 1/buffer.readDoubleLE(0)<0);
+ ASSERT.equal(false, 1 / buffer.readDoubleLE(0) < 0);
buffer[7] = 0x80;
ASSERT.equal(6.3e-322, buffer.readDoubleBE(0));
ASSERT.equal(0, buffer.readDoubleLE(0));
- ASSERT.equal(true, 1/buffer.readDoubleLE(0)<0);
+ ASSERT.equal(true, 1 / buffer.readDoubleLE(0) < 0);
buffer[6] = 0xf0;
buffer[7] = 0x7f;
diff --git a/test/simple/test-readfloat.js b/test/simple/test-readfloat.js
index 0e259b5631..bdfa7cf9cd 100644
--- a/test/simple/test-readfloat.js
+++ b/test/simple/test-readfloat.js
@@ -43,12 +43,12 @@ function test() {
buffer[3] = 0;
ASSERT.equal(0, buffer.readFloatBE(0));
ASSERT.equal(0, buffer.readFloatLE(0));
- ASSERT.equal(false, 1/buffer.readFloatLE(0)<0);
+ ASSERT.equal(false, 1 / buffer.readFloatLE(0) < 0);
buffer[3] = 0x80;
ASSERT.equal(1.793662034335766e-43, buffer.readFloatBE(0));
ASSERT.equal(0, buffer.readFloatLE(0));
- ASSERT.equal(true, 1/buffer.readFloatLE(0)<0);
+ ASSERT.equal(true, 1 / buffer.readFloatLE(0) < 0);
buffer[0] = 0;
buffer[1] = 0;
diff --git a/test/simple/test-regress-GH-1531.js b/test/simple/test-regress-GH-1531.js
index 62899a91e9..58086e0879 100644
--- a/test/simple/test-regress-GH-1531.js
+++ b/test/simple/test-regress-GH-1531.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -38,19 +38,19 @@ var gotCallback = false;
var server = https.createServer(options, function(req, res) {
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
});
server.listen(common.PORT, function() {
- https.get({
- path: '/',
- port: common.PORT,
+ https.get({
+ path: '/',
+ port: common.PORT,
agent: false
- }, function (res) {
+ }, function(res) {
console.error(res.statusCode);
gotCallback = true;
server.close();
- }).on('error', function (e) {
+ }).on('error', function(e) {
console.error(e.message);
process.exit(1);
});
diff --git a/test/simple/test-regress-GH-1726.js b/test/simple/test-regress-GH-1726.js
index a780203351..2ed3004537 100644
--- a/test/simple/test-regress-GH-1726.js
+++ b/test/simple/test-regress-GH-1726.js
@@ -38,7 +38,7 @@ if (gen === maxGen) {
}
var child = ch.spawn(process.execPath, [__filename, gen + 1], {
- customFds: [ 0, -1, 2]
+ customFds: [0, -1, 2]
});
assert.ok(!child.stdin);
assert.ok(child.stdout);
@@ -52,13 +52,13 @@ var timer = setTimeout(function () {
}, 1000);
*/
-child.on('exit', function (code) {
+child.on('exit', function(code) {
console.error('exit %d from gen %d', code, gen + 1);
//clearTimeout(timer);
});
child.stdout.pipe(process.stdout);
-child.stdout.on("close", function() {
- console.error("child.stdout close gen=%d", gen);
+child.stdout.on('close', function() {
+ console.error('child.stdout close gen=%d', gen);
});
diff --git a/test/simple/test-regress-GH-784.js b/test/simple/test-regress-GH-784.js
index f4c72bba9f..a33b6f23c4 100644
--- a/test/simple/test-regress-GH-784.js
+++ b/test/simple/test-regress-GH-784.js
@@ -31,18 +31,18 @@ server.on('listening', pingping);
function serverOn() {
- console.error("Server ON");
+ console.error('Server ON');
server.listen(common.PORT);
}
function serverOff() {
- console.error("Server OFF");
+ console.error('Server OFF');
server.close();
pingping();
}
-var responses = []
+var responses = [];
function afterPing(result) {
@@ -78,7 +78,7 @@ function afterPing(result) {
function ping() {
- console.error("making req");
+ console.error('making req');
var opt = {
port: common.PORT,
@@ -98,7 +98,7 @@ function ping() {
assert.equal('PONG', body);
assert.ok(!hadError);
gotEnd = true;
- afterPing("success");
+ afterPing('success');
});
});
@@ -108,7 +108,7 @@ function ping() {
var hadError = false;
req.on('error', function(error) {
- console.log("Error making ping req: " + error);
+ console.log('Error making ping req: ' + error);
hadError = true;
assert.ok(!gotEnd);
afterPing(error.message);
diff --git a/test/simple/test-regress-GH-819.js b/test/simple/test-regress-GH-819.js
index 50e037b461..16d0f3bc54 100644
--- a/test/simple/test-regress-GH-819.js
+++ b/test/simple/test-regress-GH-819.js
@@ -3,5 +3,5 @@ var net = require('net');
var assert = require('assert');
// Connect to something that we need to DNS resolve
-var c = net.createConnection(80, "google.com");
+var c = net.createConnection(80, 'google.com');
c.destroy();
diff --git a/test/simple/test-regress-GH-877.js b/test/simple/test-regress-GH-877.js
index d7fc8fc3a4..9021354636 100644
--- a/test/simple/test-regress-GH-877.js
+++ b/test/simple/test-regress-GH-877.js
@@ -9,16 +9,16 @@ var maxQueued = 0;
var agent = http.globalAgent;
agent.maxSockets = 10;
-var server = http.createServer(function (req, res) {
+var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello World\n');
});
-server.listen(common.PORT, "127.0.0.1", function() {
+server.listen(common.PORT, '127.0.0.1', function() {
for (var i = 0; i < N; i++) {
var options = {
host: '127.0.0.1',
- port: common.PORT,
+ port: common.PORT
};
var req = http.get(options, function(res) {
@@ -29,12 +29,12 @@ server.listen(common.PORT, "127.0.0.1", function() {
assert.equal(req.agent, agent);
- console.log('Socket: ' + agent.sockets['127.0.0.1:'+common.PORT].length +
+ console.log('Socket: ' + agent.sockets['127.0.0.1:' + common.PORT].length +
'/' + agent.maxSockets +
- ' queued: '+ (agent.requests['127.0.0.1:'+common.PORT] ? agent.requests['127.0.0.1:'+common.PORT].length : 0));
+ ' queued: ' + (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0));
- if (maxQueued < (agent.requests['127.0.0.1:'+common.PORT] ? agent.requests['127.0.0.1:'+common.PORT].length : 0)) {
- maxQueued = (agent.requests['127.0.0.1:'+common.PORT] ? agent.requests['127.0.0.1:'+common.PORT].length : 0);
+ if (maxQueued < (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0)) {
+ maxQueued = (agent.requests['127.0.0.1:' + common.PORT] ? agent.requests['127.0.0.1:' + common.PORT].length : 0);
}
}
});
diff --git a/test/simple/test-regress-GH-892.js b/test/simple/test-regress-GH-892.js
index 960c4dbd07..584b186d3f 100644
--- a/test/simple/test-regress-GH-892.js
+++ b/test/simple/test-regress-GH-892.js
@@ -34,7 +34,7 @@ var spawn = require('child_process').spawn;
var https = require('https');
var fs = require('fs');
-var PORT = 8000
+var PORT = 8000;
var bytesExpected = 1024 * 1024 * 32;
@@ -51,7 +51,7 @@ function makeRequest() {
var stderrBuffer = '';
var child = spawn(process.execPath,
- [ childScript, common.PORT, bytesExpected ]);
+ [childScript, common.PORT, bytesExpected]);
child.on('exit', function(code) {
assert.ok(/DONE/.test(stderrBuffer));
@@ -98,11 +98,11 @@ var server = https.Server(serverOptions, function(req, res) {
});
server.listen(common.PORT, function() {
- console.log("expecting %d bytes", bytesExpected);
+ console.log('expecting %d bytes', bytesExpected);
makeRequest();
});
process.on('exit', function() {
- console.error("got %d bytes", uploadCount);
+ console.error('got %d bytes', uploadCount);
assert.equal(uploadCount, bytesExpected);
});
diff --git a/test/simple/test-regress-GH-897.js b/test/simple/test-regress-GH-897.js
index 937226d42b..fae1bd4b5d 100644
--- a/test/simple/test-regress-GH-897.js
+++ b/test/simple/test-regress-GH-897.js
@@ -3,7 +3,7 @@ var assert = require('assert');
var t = Date.now();
var diff;
-setTimeout(function () {
+setTimeout(function() {
diff = Date.now() - t;
console.error(diff);
}, 0.1);
diff --git a/test/simple/test-repl.js b/test/simple/test-repl.js
index ba0bb3a5d2..c9ccbf71a8 100644
--- a/test/simple/test-repl.js
+++ b/test/simple/test-repl.js
@@ -123,12 +123,12 @@ function error_test() {
{ client: client_unix, send: 'function blah() { return 1; }',
expect: prompt_unix },
{ client: client_unix, send: 'blah()',
- expect: "1\n" + prompt_unix },
+ expect: '1\n' + prompt_unix },
// Multiline object
{ client: client_unix, send: '{ a: ',
expect: prompt_multiline },
{ client: client_unix, send: '1 }',
- expect: "{ a: 1 }" },
+ expect: '{ a: 1 }' },
// Multiline anonymous function with comment
{ client: client_unix, send: '(function () {',
expect: prompt_multiline },
@@ -137,7 +137,7 @@ function error_test() {
{ client: client_unix, send: 'return 1;',
expect: prompt_multiline },
{ client: client_unix, send: '})()',
- expect: "1" },
+ expect: '1' }
]);
}
@@ -234,7 +234,7 @@ function unix_test() {
{ client: client_unix, send: 'a = 12345\n',
expect: ('12345' + '\n' + prompt_unix) },
{ client: client_unix, send: '{a:1}\n',
- expect: ('{ a: 1 }' + '\n' + prompt_unix) },
+ expect: ('{ a: 1 }' + '\n' + prompt_unix) }
]);
});
diff --git a/test/simple/test-require-cache-without-stat.js b/test/simple/test-require-cache-without-stat.js
index 7c85a4ba94..c2c6c06552 100644
--- a/test/simple/test-require-cache-without-stat.js
+++ b/test/simple/test-require-cache-without-stat.js
@@ -50,7 +50,7 @@ require('../fixtures/a.js');
require('./../fixtures/a.js');
require('http');
-console.log("counterBefore = %d", counter);
+console.log('counterBefore = %d', counter);
var counterBefore = counter;
// Now load the module a bunch of times with equivalent paths.
@@ -66,7 +66,7 @@ for (var i = 0; i < 100; i++) {
require('http');
}
-console.log("counterAfter = %d", counter);
+console.log('counterAfter = %d', counter);
var counterAfter = counter;
assert.equal(counterBefore, counterAfter);
diff --git a/test/simple/test-script-context.js b/test/simple/test-script-context.js
index fe6b9b68c5..581974418d 100644
--- a/test/simple/test-script-context.js
+++ b/test/simple/test-script-context.js
@@ -50,11 +50,11 @@ Script.runInNewContext('', null, 'some.js');
common.debug('test runInContext signature');
var gh1140Exception;
try {
- Script.runInContext('throw new Error()', context, 'expected-filename.js');
+ Script.runInContext('throw new Error()', context, 'expected-filename.js');
}
catch (e) {
- gh1140Exception = e;
- assert.ok(/expected-filename/.test(e.stack), 'expected appearance of filename in Error stack');
+ gh1140Exception = e;
+ assert.ok(/expected-filename/.test(e.stack), 'expected appearance of filename in Error stack');
}
assert.ok(gh1140Exception, 'expected exception from runInContext signature test');
diff --git a/test/simple/test-signal-handler.js b/test/simple/test-signal-handler.js
index 01552dcd2f..47f303c273 100644
--- a/test/simple/test-signal-handler.js
+++ b/test/simple/test-signal-handler.js
@@ -56,9 +56,9 @@ setInterval(function() {
// Test addListener condition where a watcher for SIGNAL
// has been previously registered, and `process.listeners(SIGNAL).length === 1`
-process.addListener('SIGHUP', function () {});
+process.addListener('SIGHUP', function() {});
process.removeAllListeners('SIGHUP');
-process.addListener('SIGHUP', function () { sighup = true });
+process.addListener('SIGHUP', function() { sighup = true });
process.kill(process.pid, 'SIGHUP');
process.addListener('exit', function() {
diff --git a/test/simple/test-stdin-from-file.js b/test/simple/test-stdin-from-file.js
index 37d8be52e1..0a596dfe12 100644
--- a/test/simple/test-stdin-from-file.js
+++ b/test/simple/test-stdin-from-file.js
@@ -31,7 +31,8 @@ var fs = require('fs');
var stdoutScript = join(common.fixturesDir, 'echo.js');
var tmpFile = join(common.fixturesDir, 'stdin.txt');
-var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' + tmpFile + '"';
+var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' +
+ tmpFile + '"';
var string = 'abc\nümlaut.\nsomething else\n' +
'南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' +
diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js
index ba3ffe128c..c2df97019b 100644
--- a/test/simple/test-stream-pipe-cleanup.js
+++ b/test/simple/test-stream-pipe-cleanup.js
@@ -26,21 +26,21 @@ var stream = require('stream');
var assert = require('assert');
var util = require('util');
-function Writable () {
+function Writable() {
this.writable = true;
this.endCalls = 0;
stream.Stream.call(this);
}
util.inherits(Writable, stream.Stream);
-Writable.prototype.end = function () {
+Writable.prototype.end = function() {
this.endCalls++;
-}
+};
-Writable.prototype.destroy = function () {
+Writable.prototype.destroy = function() {
this.endCalls++;
-}
+};
-function Readable () {
+function Readable() {
this.readable = true;
stream.Stream.call(this);
}
@@ -51,16 +51,16 @@ var limit = 100;
var w = new Writable();
-console.error = function (text) {
+console.error = function(text) {
throw new Error(text);
-}
+};
var r;
for (i = 0; i < limit; i++) {
- r = new Readable()
- r.pipe(w)
- r.emit('end')
+ r = new Readable();
+ r.pipe(w);
+ r.emit('end');
}
assert.equal(0, r.listeners('end').length);
assert.equal(limit, w.endCalls);
@@ -68,9 +68,9 @@ assert.equal(limit, w.endCalls);
w.endCalls = 0;
for (i = 0; i < limit; i++) {
- r = new Readable()
- r.pipe(w)
- r.emit('close')
+ r = new Readable();
+ r.pipe(w);
+ r.emit('close');
}
assert.equal(0, r.listeners('close').length);
assert.equal(limit, w.endCalls);
@@ -78,13 +78,13 @@ assert.equal(limit, w.endCalls);
w.endCalls = 0;
var r2;
-r = new Readable()
+r = new Readable();
r2 = new Readable();
-r.pipe(w)
-r2.pipe(w)
-r.emit('close')
-r2.emit('close')
+r.pipe(w);
+r2.pipe(w);
+r.emit('close');
+r2.emit('close');
assert.equal(1, w.endCalls);
r = new Readable();
diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js
index 868158f2a6..7b2fb87b52 100644
--- a/test/simple/test-stream-pipe-event.js
+++ b/test/simple/test-stream-pipe-event.js
@@ -23,13 +23,13 @@ var stream = require('stream');
var assert = require('assert');
var util = require('util');
-function Writable () {
+function Writable() {
this.writable = true;
stream.Stream.call(this);
}
util.inherits(Writable, stream.Stream);
-function Readable () {
+function Readable() {
this.readable = true;
stream.Stream.call(this);
}
@@ -38,11 +38,11 @@ util.inherits(Readable, stream.Stream);
var passed = false;
var w = new Writable();
-w.on('pipe', function (src) {
+w.on('pipe', function(src) {
passed = true;
});
var r = new Readable();
r.pipe(w);
-assert.ok(passed)
+assert.ok(passed);
diff --git a/test/simple/test-stream-pipe-multi.js b/test/simple/test-stream-pipe-multi.js
index a6931ab7a5..00d17f1742 100644
--- a/test/simple/test-stream-pipe-multi.js
+++ b/test/simple/test-stream-pipe-multi.js
@@ -1,9 +1,9 @@
// Test that having a bunch of streams piping in parallel
// doesn't break anything.
-var common = require("../common");
-var assert = require("assert");
-var Stream = require("stream").Stream;
+var common = require('../common');
+var assert = require('assert');
+var Stream = require('stream').Stream;
var rr = [];
var ww = [];
var cnt = 100;
@@ -23,46 +23,46 @@ function FakeStream() {
FakeStream.prototype = Object.create(Stream.prototype);
FakeStream.prototype.write = function(chunk) {
- console.error(this.ID, "write", this.wait)
+ console.error(this.ID, 'write', this.wait);
if (this.wait) {
- process.nextTick(this.emit.bind(this, "drain"));
+ process.nextTick(this.emit.bind(this, 'drain'));
}
this.wait = !this.wait;
return this.wait;
};
FakeStream.prototype.end = function() {
- this.emit("end");
+ this.emit('end');
process.nextTick(this.close.bind(this));
};
// noop - closes happen automatically on end.
FakeStream.prototype.close = function() {
- this.emit("close");
+ this.emit('close');
};
// expect all streams to close properly.
-process.on("exit", function() {
- assert.equal(cnt, wclosed, "writable streams closed");
- assert.equal(cnt, rclosed, "readable streams closed");
+process.on('exit', function() {
+ assert.equal(cnt, wclosed, 'writable streams closed');
+ assert.equal(cnt, rclosed, 'readable streams closed');
});
-for (var i = 0; i < chunkSize; i ++) {
+for (var i = 0; i < chunkSize; i++) {
chunkSize[i] = i % 256;
}
for (var i = 0; i < cnt; i++) {
var r = new FakeStream();
- r.on("close", function() {
- console.error(this.ID, "read close");
+ r.on('close', function() {
+ console.error(this.ID, 'read close');
rclosed++;
});
rr.push(r);
var w = new FakeStream();
- w.on("close", function() {
- console.error(this.ID, "write close");
+ w.on('close', function() {
+ console.error(this.ID, 'write close');
wclosed++;
});
ww.push(w);
@@ -73,21 +73,21 @@ for (var i = 0; i < cnt; i++) {
// now start passing through data
// simulate a relatively fast async stream.
-rr.forEach(function (r) {
+rr.forEach(function(r) {
var cnt = chunks;
var paused = false;
- r.on("pause", function() {
+ r.on('pause', function() {
paused = true;
});
- r.on("resume", function() {
+ r.on('resume', function() {
paused = false;
step();
});
function step() {
- r.emit("data", data);
+ r.emit('data', data);
if (--cnt === 0) {
r.end();
return;
diff --git a/test/simple/test-tcp-wrap-connect.js b/test/simple/test-tcp-wrap-connect.js
index 250670128e..1f04fcf0e5 100644
--- a/test/simple/test-tcp-wrap-connect.js
+++ b/test/simple/test-tcp-wrap-connect.js
@@ -11,10 +11,10 @@ function makeConnection() {
assert.equal(client, client_);
assert.equal(req, req_);
- console.log("connected");
+ console.log('connected');
var shutdownReq = client.shutdown();
shutdownReq.oncomplete = function(status, client_, req_) {
- console.log("shutdown complete");
+ console.log('shutdown complete');
assert.equal(0, status);
assert.equal(client, client_);
assert.equal(shutdownReq, req_);
@@ -31,10 +31,10 @@ var endCount = 0;
var shutdownCount = 0;
var server = require('net').Server(function(s) {
- console.log("got connection");
+ console.log('got connection');
connectCount++;
s.on('end', function() {
- console.log("got eof");
+ console.log('got eof');
endCount++;
s.destroy();
server.close();
diff --git a/test/simple/test-tcp-wrap-listen.js b/test/simple/test-tcp-wrap-listen.js
index f0367c6296..c9c51c5898 100644
--- a/test/simple/test-tcp-wrap-listen.js
+++ b/test/simple/test-tcp-wrap-listen.js
@@ -5,7 +5,7 @@ var TCP = process.binding('tcp_wrap').TCP;
var server = new TCP();
-var r = server.bind("0.0.0.0", common.PORT);
+var r = server.bind('0.0.0.0', common.PORT);
assert.equal(0, r);
server.listen(128);
@@ -17,11 +17,11 @@ var recvCount = 0;
server.onconnection = function(client) {
assert.equal(0, client.writeQueueSize);
- console.log("got connection");
+ console.log('got connection');
function maybeCloseClient() {
if (client.pendingWrites.length == 0 && client.gotEOF) {
- console.log("close client");
+ console.log('close client');
client.close();
}
}
@@ -37,7 +37,7 @@ server.onconnection = function(client) {
var req = client.write(buffer, offset, length);
client.pendingWrites.push(req);
- console.log("client.writeQueueSize: " + client.writeQueueSize);
+ console.log('client.writeQueueSize: ' + client.writeQueueSize);
// 11 bytes should flush
assert.equal(0, client.writeQueueSize);
@@ -50,17 +50,17 @@ server.onconnection = function(client) {
assert.equal(req, req_);
assert.equal(buffer, buffer_);
- console.log("client.writeQueueSize: " + client.writeQueueSize);
+ console.log('client.writeQueueSize: ' + client.writeQueueSize);
assert.equal(0, client.writeQueueSize);
writeCount++;
- console.log("write " + writeCount);
+ console.log('write ' + writeCount);
maybeCloseClient();
};
sliceCount++;
} else {
- console.log("eof");
+ console.log('eof');
client.gotEOF = true;
server.close();
eofCount++;
@@ -73,7 +73,7 @@ var net = require('net');
var c = net.createConnection(common.PORT);
c.on('connect', function() {
- c.end("hello world");
+ c.end('hello world');
});
c.setEncoding('utf8');
@@ -83,7 +83,7 @@ c.on('data', function(d) {
});
c.on('close', function() {
- console.error("client closed");
+ console.error('client closed');
});
process.on('exit', function() {
diff --git a/test/simple/test-tcp-wrap.js b/test/simple/test-tcp-wrap.js
index 58d3ac1b59..db11dd1c08 100644
--- a/test/simple/test-tcp-wrap.js
+++ b/test/simple/test-tcp-wrap.js
@@ -6,13 +6,13 @@ var TCP = process.binding('tcp_wrap').TCP;
var handle = new TCP();
// Should be able to bind to the common.PORT
-var r = handle.bind("0.0.0.0", common.PORT);
+var r = handle.bind('0.0.0.0', common.PORT);
assert.equal(0, r);
// Should not be able to bind to the same port again
-var r = handle.bind("0.0.0.0", common.PORT);
+var r = handle.bind('0.0.0.0', common.PORT);
assert.equal(-1, r);
console.log(errno);
-assert.equal(errno, "EINVAL");
+assert.equal(errno, 'EINVAL');
handle.close();
diff --git a/test/simple/test-timers-linked-list.js b/test/simple/test-timers-linked-list.js
index a1b8f0625f..0b6bf4bef8 100644
--- a/test/simple/test-timers-linked-list.js
+++ b/test/simple/test-timers-linked-list.js
@@ -24,11 +24,11 @@ var assert = require('assert');
var L = require('_linklist');
-var list = { name: "list" };
-var A = { name: "A" };
-var B = { name: "B" };
-var C = { name: "C" };
-var D = { name: "D" };
+var list = { name: 'list' };
+var A = { name: 'A' };
+var B = { name: 'B' };
+var C = { name: 'C' };
+var D = { name: 'D' };
L.init(list);
@@ -85,7 +85,7 @@ L.remove(B);
assert.equal(D, L.peek(list));
L.remove(D);
-// list
+// list
assert.equal(null, L.peek(list));
diff --git a/test/simple/test-tls-client-abort.js b/test/simple/test-tls-client-abort.js
index 4ae5e65e1e..19b69f25da 100644
--- a/test/simple/test-tls-client-abort.js
+++ b/test/simple/test-tls-client-abort.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -33,7 +33,7 @@ var path = require('path');
var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
var key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
-var conn = tls.connect(common.PORT, {cert:cert, key:key}, function() {
+var conn = tls.connect(common.PORT, {cert: cert, key: key}, function() {
assert.ok(false); // callback should never be executed
});
conn.on('error', function() {
diff --git a/test/simple/test-tls-client-resume.js b/test/simple/test-tls-client-resume.js
index bdf0527fb7..2e165596dd 100644
--- a/test/simple/test-tls-client-resume.js
+++ b/test/simple/test-tls-client-resume.js
@@ -24,7 +24,7 @@
// ASSERT resumption.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -42,7 +42,7 @@ var connections = 0;
// create server
var server = tls.Server(options, function(socket) {
- socket.end("Goodbye");
+ socket.end('Goodbye');
connections++;
});
@@ -50,18 +50,18 @@ var server = tls.Server(options, function(socket) {
server.listen(common.PORT, function() {
var session1 = null;
- var client1 = tls.connect(common.PORT, function () {
+ var client1 = tls.connect(common.PORT, function() {
console.log('connect1');
- assert.ok(!client1.isSessionReused(), "Session *should not* be reused.");
+ assert.ok(!client1.isSessionReused(), 'Session *should not* be reused.');
session1 = client1.getSession();
});
client1.on('close', function() {
console.log('close1');
- var client2 = tls.connect(common.PORT, {'session':session1}, function () {
+ var client2 = tls.connect(common.PORT, {'session': session1}, function() {
console.log('connect2');
- assert.ok(client2.isSessionReused(), "Session *should* be reused.");
+ assert.ok(client2.isSessionReused(), 'Session *should* be reused.');
});
client2.on('close', function() {
diff --git a/test/simple/test-tls-client-verify.js b/test/simple/test-tls-client-verify.js
index 0e6ef790da..4a1b82aaab 100644
--- a/test/simple/test-tls-client-verify.js
+++ b/test/simple/test-tls-client-verify.js
@@ -20,42 +20,42 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
var testCases =
- [ { ca: ['ca1-cert'],
- key: 'agent2-key',
- cert: 'agent2-cert',
- servers: [
- { ok: true, key: 'agent1-key', cert: 'agent1-cert' },
- { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
- { ok: false, key: 'agent3-key', cert: 'agent3-cert' },
- ]
- },
-
- { ca: [],
- key: 'agent2-key',
- cert: 'agent2-cert',
- servers: [
- { ok: false, key: 'agent1-key', cert: 'agent1-cert' },
- { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
- { ok: false, key: 'agent3-key', cert: 'agent3-cert' },
- ]
- },
-
- { ca: ['ca1-cert', 'ca2-cert'],
- key: 'agent2-key',
- cert: 'agent2-cert',
- servers: [
- { ok: true, key: 'agent1-key', cert: 'agent1-cert' },
- { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
- { ok: true, key: 'agent3-key', cert: 'agent3-cert' },
- ]
- },
- ];
+ [{ ca: ['ca1-cert'],
+ key: 'agent2-key',
+ cert: 'agent2-cert',
+ servers: [
+ { ok: true, key: 'agent1-key', cert: 'agent1-cert' },
+ { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
+ { ok: false, key: 'agent3-key', cert: 'agent3-cert' }
+ ]
+ },
+
+ { ca: [],
+ key: 'agent2-key',
+ cert: 'agent2-cert',
+ servers: [
+ { ok: false, key: 'agent1-key', cert: 'agent1-cert' },
+ { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
+ { ok: false, key: 'agent3-key', cert: 'agent3-cert' }
+ ]
+ },
+
+ { ca: ['ca1-cert', 'ca2-cert'],
+ key: 'agent2-key',
+ cert: 'agent2-cert',
+ servers: [
+ { ok: true, key: 'agent1-key', cert: 'agent1-cert' },
+ { ok: false, key: 'agent2-key', cert: 'agent2-cert' },
+ { ok: true, key: 'agent3-key', cert: 'agent3-cert' }
+ ]
+ }
+ ];
var common = require('../common');
@@ -65,7 +65,7 @@ var tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + ".pem");
+ return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}
@@ -85,26 +85,26 @@ function testServers(index, servers, clientOptions, cb) {
var ok = serverOptions.ok;
if (serverOptions.key) {
- serverOptions.key = loadPEM(serverOptions.key);
+ serverOptions.key = loadPEM(serverOptions.key);
}
- if (serverOptions.cert) {
- serverOptions.cert = loadPEM(serverOptions.cert);
+ if (serverOptions.cert) {
+ serverOptions.cert = loadPEM(serverOptions.cert);
}
var server = tls.createServer(serverOptions, function(s) {
- s.end("hello world\n");
+ s.end('hello world\n');
});
server.listen(common.PORT, function() {
var b = '';
- console.error("connecting...");
- var client = tls.connect(common.PORT, clientOptions, function () {
+ console.error('connecting...');
+ var client = tls.connect(common.PORT, clientOptions, function() {
- console.error("expected: " + ok + " authed: " + client.authorized);
+ console.error('expected: ' + ok + ' authed: ' + client.authorized);
- assert.equal(ok, client.authorized);
+ assert.equal(ok, client.authorized);
server.close();
});
@@ -123,7 +123,7 @@ function testServers(index, servers, clientOptions, cb) {
}
-function runTest (testIndex) {
+function runTest(testIndex) {
var tcase = testCases[testIndex];
if (!tcase) return;
@@ -134,7 +134,7 @@ function runTest (testIndex) {
};
- testServers(0, tcase.servers, clientOptions, function () {
+ testServers(0, tcase.servers, clientOptions, function() {
successfulTests++;
runTest(testIndex + 1);
});
@@ -145,6 +145,6 @@ runTest(0);
process.on('exit', function() {
- console.log("successful tests: %d", successfulTests);
+ console.log('successful tests: %d', successfulTests);
assert.equal(successfulTests, testCases.length);
});
diff --git a/test/simple/test-tls-connect.js b/test/simple/test-tls-connect.js
index 5b608eaba1..5e5f42df36 100644
--- a/test/simple/test-tls-connect.js
+++ b/test/simple/test-tls-connect.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -30,7 +30,8 @@ var fs = require('fs');
var tls = require('tls');
var path = require('path');
-// https://github.com/joyent/node/issues/1218 - uncatchable exception on TLS connection error
+// https://github.com/joyent/node/issues/1218
+// uncatchable exception on TLS connection error
(function() {
var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
var key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
@@ -41,7 +42,7 @@ var path = require('path');
assert.ok(errorEmitted);
});
- var conn = tls.connect(common.PORT, {cert:cert, key:key}, function() {
+ var conn = tls.connect(common.PORT, {cert: cert, key: key}, function() {
assert.ok(false); // callback should never be executed
});
diff --git a/test/simple/test-tls-ext-key-usage.js b/test/simple/test-tls-ext-key-usage.js
index 20b2a76b1e..d88574d599 100644
--- a/test/simple/test-tls-ext-key-usage.js
+++ b/test/simple/test-tls-ext-key-usage.js
@@ -27,7 +27,7 @@
// test for all openssl versions less than 1.0.0.
if (!process.versions.openssl ||
parseInt(process.versions.openssl[0]) < 1) {
- console.error("Skipping due to old OpenSSL version.");
+ console.error('Skipping due to old OpenSSL version.');
process.exit(0);
}
@@ -96,7 +96,7 @@ server.stdout.on('data', function(s) {
});
-var timeout = setTimeout(function () {
+var timeout = setTimeout(function() {
server.kill();
process.exit(1);
}, 5000);
@@ -137,12 +137,13 @@ function startClient() {
// "TLS Web Client Authentication"
assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1);
- assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0], '1.3.6.1.5.5.7.3.2');
+ assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0],
+ '1.3.6.1.5.5.7.3.2');
console.log('client pair.cleartext.getCipher(): %j',
pair.cleartext.getCipher());
setTimeout(function() {
- pair.cleartext.write('hello\r\n', function () {
+ pair.cleartext.write('hello\r\n', function() {
gotWriteCallback = true;
});
}, 500);
diff --git a/test/simple/test-tls-junk-closes-server.js b/test/simple/test-tls-junk-closes-server.js
index 2a163891df..d4f9f1d86a 100644
--- a/test/simple/test-tls-junk-closes-server.js
+++ b/test/simple/test-tls-junk-closes-server.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -34,19 +34,19 @@ var options = {
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
};
-var server = tls.createServer(function (s) {
- s.write("welcome!\n");
+var server = tls.createServer(function(s) {
+ s.write('welcome!\n');
s.pipe(s);
});
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
var c = net.createConnection(common.PORT);
- c.on('connect', function () {
- c.write("blah\nblah\nblah\n");
+ c.on('connect', function() {
+ c.write('blah\nblah\nblah\n');
});
- c.on('end', function () {
+ c.on('end', function() {
server.close();
});
diff --git a/test/simple/test-tls-npn-server-client.js b/test/simple/test-tls-npn-server-client.js
index c81a9e0634..95eaf16721 100644
--- a/test/simple/test-tls-npn-server-client.js
+++ b/test/simple/test-tls-npn-server-client.js
@@ -20,8 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.features.tls_npn) {
- console.error("Skipping because node compiled without OpenSSL or " +
- "with old OpenSSL version.");
+ console.error('Skipping because node compiled without OpenSSL or ' +
+ 'with old OpenSSL version.');
process.exit(0);
}
@@ -31,7 +31,7 @@ var common = require('../common'),
tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + ".pem");
+ return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}
function loadPEM(n) {
@@ -89,7 +89,7 @@ function startTest() {
});
});
});
-};
+}
process.on('exit', function() {
assert.equal(serverResults[0], clientsResults[0]);
diff --git a/test/simple/test-tls-peer-certificate.js b/test/simple/test-tls-peer-certificate.js
index 6ef03c7a6f..fe498422c0 100644
--- a/test/simple/test-tls-peer-certificate.js
+++ b/test/simple/test-tls-peer-certificate.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
diff --git a/test/simple/test-tls-securepair-client.js b/test/simple/test-tls-securepair-client.js
index 8006a26535..0f530724b4 100644
--- a/test/simple/test-tls-securepair-client.js
+++ b/test/simple/test-tls-securepair-client.js
@@ -27,7 +27,7 @@
// test for all openssl versions less than 1.0.0.
if (!process.versions.openssl ||
parseInt(process.versions.openssl[0]) < 1) {
- console.error("Skipping due to old OpenSSL version.");
+ console.error('Skipping due to old OpenSSL version.');
process.exit(0);
}
@@ -96,7 +96,7 @@ server.stdout.on('data', function(s) {
});
-var timeout = setTimeout(function () {
+var timeout = setTimeout(function() {
server.kill();
process.exit(1);
}, 5000);
@@ -137,7 +137,7 @@ function startClient() {
console.log('client pair.cleartext.getCipher(): %j',
pair.cleartext.getCipher());
setTimeout(function() {
- pair.cleartext.write('hello\r\n', function () {
+ pair.cleartext.write('hello\r\n', function() {
gotWriteCallback = true;
});
}, 500);
diff --git a/test/simple/test-tls-securepair-server.js b/test/simple/test-tls-securepair-server.js
index 124c045a03..3b4eec1eef 100644
--- a/test/simple/test-tls-securepair-server.js
+++ b/test/simple/test-tls-securepair-server.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -115,7 +115,8 @@ var opensslExitCode = -1;
server.listen(common.PORT, function() {
// To test use: openssl s_client -connect localhost:8000
- var client = spawn('openssl', ['s_client', '-connect', '127.0.0.1:' + common.PORT]);
+ var client = spawn('openssl', ['s_client', '-connect', '127.0.0.1:' +
+ common.PORT]);
var out = '';
diff --git a/test/simple/test-tls-server-verify.js b/test/simple/test-tls-server-verify.js
index 05a8a4aa92..d652576ede 100644
--- a/test/simple/test-tls-server-verify.js
+++ b/test/simple/test-tls-server-verify.js
@@ -23,7 +23,7 @@
if (!process.versions.openssl) {
- console.error("Skipping because node compiled without OpenSSL.");
+ console.error('Skipping because node compiled without OpenSSL.');
process.exit(0);
}
@@ -36,70 +36,71 @@ if (!process.versions.openssl) {
// - accepted and "authorized".
var testCases =
- [ { title: "Do not request certs. Everyone is unauthorized.",
+ [{ title: 'Do not request certs. Everyone is unauthorized.',
requestCert: false,
rejectUnauthorized: false,
CAs: ['ca1-cert'],
clients:
- [ { name: 'agent1', shouldReject: false, shouldAuth: false },
- { name: 'agent2', shouldReject: false, shouldAuth: false },
- { name: 'agent3', shouldReject: false, shouldAuth: false },
- { name: 'nocert', shouldReject: false, shouldAuth: false }
- ]
+ [{ name: 'agent1', shouldReject: false, shouldAuth: false },
+ { name: 'agent2', shouldReject: false, shouldAuth: false },
+ { name: 'agent3', shouldReject: false, shouldAuth: false },
+ { name: 'nocert', shouldReject: false, shouldAuth: false }
+ ]
},
- { title: "Allow both authed and unauthed connections with CA1",
+ { title: 'Allow both authed and unauthed connections with CA1',
requestCert: true,
rejectUnauthorized: false,
CAs: ['ca1-cert'],
clients:
- [ { name: 'agent1', shouldReject: false, shouldAuth: true },
- { name: 'agent2', shouldReject: false, shouldAuth: false },
- { name: 'agent3', shouldReject: false, shouldAuth: false },
- { name: 'nocert', shouldReject: false, shouldAuth: false }
- ]
+ [{ name: 'agent1', shouldReject: false, shouldAuth: true },
+ { name: 'agent2', shouldReject: false, shouldAuth: false },
+ { name: 'agent3', shouldReject: false, shouldAuth: false },
+ { name: 'nocert', shouldReject: false, shouldAuth: false }
+ ]
},
- { title: "Allow only authed connections with CA1",
+ { title: 'Allow only authed connections with CA1',
requestCert: true,
rejectUnauthorized: true,
CAs: ['ca1-cert'],
clients:
- [ { name: 'agent1', shouldReject: false, shouldAuth: true },
- { name: 'agent2', shouldReject: true },
- { name: 'agent3', shouldReject: true },
- { name: 'nocert', shouldReject: true }
- ]
+ [{ name: 'agent1', shouldReject: false, shouldAuth: true },
+ { name: 'agent2', shouldReject: true },
+ { name: 'agent3', shouldReject: true },
+ { name: 'nocert', shouldReject: true }
+ ]
},
- { title: "Allow only authed connections with CA1 and CA2",
+ { title: 'Allow only authed connections with CA1 and CA2',
requestCert: true,
rejectUnauthorized: true,
CAs: ['ca1-cert', 'ca2-cert'],
clients:
- [ { name: 'agent1', shouldReject: false, shouldAuth: true },
- { name: 'agent2', shouldReject: true },
- { name: 'agent3', shouldReject: false, shouldAuth: true },
- { name: 'nocert', shouldReject: true }
- ]
+ [{ name: 'agent1', shouldReject: false, shouldAuth: true },
+ { name: 'agent2', shouldReject: true },
+ { name: 'agent3', shouldReject: false, shouldAuth: true },
+ { name: 'nocert', shouldReject: true }
+ ]
},
- { title: "Allow only certs signed by CA2 but not in the CRL",
+ { title: 'Allow only certs signed by CA2 but not in the CRL',
requestCert: true,
rejectUnauthorized: true,
CAs: ['ca2-cert'],
crl: 'ca2-crl',
clients:
- [ { name: 'agent1', shouldReject: true, shouldAuth: false },
- { name: 'agent2', shouldReject: true, shouldAuth: false },
- { name: 'agent3', shouldReject: false, shouldAuth: true },
- // Agent4 has a cert in the CRL.
- { name: 'agent4', shouldReject: true, shouldAuth: false },
- { name: 'nocert', shouldReject: true }
- ]
- },
- ];
+ [
+ { name: 'agent1', shouldReject: true, shouldAuth: false },
+ { name: 'agent2', shouldReject: true, shouldAuth: false },
+ { name: 'agent3', shouldReject: false, shouldAuth: true },
+ // Agent4 has a cert in the CRL.
+ { name: 'agent4', shouldReject: true, shouldAuth: false },
+ { name: 'nocert', shouldReject: true }
+ ]
+ }
+ ];
var common = require('../common');
@@ -110,7 +111,7 @@ var spawn = require('child_process').spawn;
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + ".pem");
+ return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}
@@ -123,7 +124,7 @@ var serverKey = loadPEM('agent2-key');
var serverCert = loadPEM('agent2-cert');
-function runClient (options, cb) {
+function runClient(options, cb) {
// Client can connect in three ways:
// - Self-signed cert
@@ -133,7 +134,7 @@ function runClient (options, cb) {
var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT];
- console.log(" connecting with", options.name);
+ console.log(' connecting with', options.name);
switch (options.name) {
case 'agent1':
@@ -174,7 +175,7 @@ function runClient (options, cb) {
break;
default:
- throw new Error("Unknown agent name");
+ throw new Error('Unknown agent name');
}
// To test use: openssl s_client -connect localhost:8000
@@ -190,14 +191,14 @@ function runClient (options, cb) {
out += d;
if (/_unauthed/g.test(out)) {
- console.error(" * unauthed");
+ console.error(' * unauthed');
client.stdin.end('goodbye\n');
authed = false;
rejected = false;
}
if (/_authed/g.test(out)) {
- console.error(" * authed");
+ console.error(' * authed');
client.stdin.end('goodbye\n');
authed = true;
rejected = false;
@@ -211,10 +212,10 @@ function runClient (options, cb) {
// ": s_client exited with error code " + code);
if (options.shouldReject) {
assert.equal(true, rejected, options.name +
- " NOT rejected, but should have been");
+ ' NOT rejected, but should have been');
} else {
assert.equal(false, rejected, options.name +
- " rejected, but should NOT have been");
+ ' rejected, but should NOT have been');
assert.equal(options.shouldAuth, authed);
}
@@ -225,7 +226,7 @@ function runClient (options, cb) {
// Run the tests
var successfulTests = 0;
-function runTest (testIndex) {
+function runTest(testIndex) {
var tcase = testCases[testIndex];
if (!tcase) return;
@@ -246,7 +247,7 @@ function runTest (testIndex) {
var connections = 0;
- var server = tls.Server(serverOptions, function (c) {
+ var server = tls.Server(serverOptions, function(c) {
connections++;
if (c.authorized) {
console.error('- authed connection: ' +
@@ -261,7 +262,7 @@ function runTest (testIndex) {
function runNextClient(clientIndex) {
var options = tcase.clients[clientIndex];
if (options) {
- runClient(options, function () {
+ runClient(options, function() {
runNextClient(clientIndex + 1);
});
} else {
@@ -273,7 +274,7 @@ function runTest (testIndex) {
server.listen(common.PORT, function() {
if (tcase.debug) {
- console.error("TLS server running on port " + common.PORT);
+ console.error('TLS server running on port ' + common.PORT);
} else {
runNextClient(0);
}
diff --git a/test/simple/test-tls-set-encoding.js b/test/simple/test-tls-set-encoding.js
index 2956eec0e2..556a3b4e0c 100644
--- a/test/simple/test-tls-set-encoding.js
+++ b/test/simple/test-tls-set-encoding.js
@@ -31,7 +31,7 @@ var options = {
};
var connections = 0;
-var message = "hello world\n";
+var message = 'hello world\n';
var server = tls.Server(options, function(socket) {
diff --git a/test/simple/test-tls-sni-server-client.js b/test/simple/test-tls-sni-server-client.js
index eeee66a4a2..7ac8972289 100644
--- a/test/simple/test-tls-sni-server-client.js
+++ b/test/simple/test-tls-sni-server-client.js
@@ -23,8 +23,8 @@
if (!process.features.tls_sni) {
- console.error("Skipping because node compiled without OpenSSL or " +
- "with old OpenSSL version.");
+ console.error('Skipping because node compiled without OpenSSL or ' +
+ 'with old OpenSSL version.');
process.exit(0);
}
@@ -34,7 +34,7 @@ var common = require('../common'),
tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + ".pem");
+ return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}
function loadPEM(n) {
@@ -106,7 +106,7 @@ function startTest() {
});
});
});
-};
+}
process.on('exit', function() {
assert.deepEqual(serverResults, ['a.example.com', 'b.test.com',
diff --git a/test/simple/test-tty-wrap.js b/test/simple/test-tty-wrap.js
index 1398e1f025..a41b75e1f1 100644
--- a/test/simple/test-tty-wrap.js
+++ b/test/simple/test-tty-wrap.js
@@ -5,19 +5,19 @@ var TTY = process.binding('tty_wrap').TTY;
var isTTY = process.binding('tty_wrap').isTTY;
if (isTTY(1) == false) {
- console.error("fd 1 is not a tty. skipping test.");
+ console.error('fd 1 is not a tty. skipping test.');
process.exit(0);
}
var handle = new TTY(1);
var callbacks = 0;
-var req1 = handle.write(Buffer("hello world\n"));
+var req1 = handle.write(Buffer('hello world\n'));
req1.oncomplete = function() {
callbacks++;
};
-var req2 = handle.write(Buffer("hello world\n"));
+var req2 = handle.write(Buffer('hello world\n'));
req2.oncomplete = function() {
callbacks++;
};
diff --git a/test/simple/test-util-inspect.js b/test/simple/test-util-inspect.js
index f37ef93b9f..57464d2541 100644
--- a/test/simple/test-util-inspect.js
+++ b/test/simple/test-util-inspect.js
@@ -35,7 +35,7 @@ var after = util.inspect(d);
assert.equal(orig, after);
// test for sparse array
-var a = [ 'foo', 'bar', 'baz' ];
+var a = ['foo', 'bar', 'baz'];
assert.equal(util.inspect(a), "[ 'foo', 'bar', 'baz' ]");
delete a[1];
assert.equal(util.inspect(a), "[ 'foo', , 'baz' ]");
@@ -54,8 +54,8 @@ try {
}
var ex = util.inspect(new Error('FAIL'), true);
console.log(ex);
-assert.ok(ex.indexOf("[Error: FAIL]") != -1);
-assert.ok(ex.indexOf("[stack]") != -1);
-assert.ok(ex.indexOf("[message]") != -1);
-assert.ok(ex.indexOf("[arguments]") != -1);
-assert.ok(ex.indexOf("[type]") != -1);
+assert.ok(ex.indexOf('[Error: FAIL]') != -1);
+assert.ok(ex.indexOf('[stack]') != -1);
+assert.ok(ex.indexOf('[message]') != -1);
+assert.ok(ex.indexOf('[arguments]') != -1);
+assert.ok(ex.indexOf('[type]') != -1);
diff --git a/test/simple/test-vm-create-context-circular-reference.js b/test/simple/test-vm-create-context-circular-reference.js
index 9e3311c13c..ae23eba167 100644
--- a/test/simple/test-vm-create-context-circular-reference.js
+++ b/test/simple/test-vm-create-context-circular-reference.js
@@ -9,4 +9,5 @@ sbx = vm.createContext(sbx);
sbx.test = 123;
-assert.equal(sbx.window.window.window.window.window.test, 123); \ No newline at end of file
+assert.equal(sbx.window.window.window.window.window.test, 123);
+
diff --git a/test/simple/test-writedouble.js b/test/simple/test-writedouble.js
index 81565189e7..de8c9378fa 100644
--- a/test/simple/test-writedouble.js
+++ b/test/simple/test-writedouble.js
@@ -82,8 +82,8 @@ function test() {
ASSERT.equal(0xef, buffer[14]);
ASSERT.equal(0x7f, buffer[15]);
- buffer.writeDoubleBE(0*-1, 0);
- buffer.writeDoubleLE(0*-1, 8);
+ buffer.writeDoubleBE(0 * -1, 0);
+ buffer.writeDoubleLE(0 * -1, 8);
ASSERT.equal(0x80, buffer[0]);
ASSERT.equal(0x00, buffer[1]);
ASSERT.equal(0x00, buffer[2]);
diff --git a/test/simple/test-writefloat.js b/test/simple/test-writefloat.js
index 64f01307be..93e2596e20 100644
--- a/test/simple/test-writefloat.js
+++ b/test/simple/test-writefloat.js
@@ -28,8 +28,8 @@ function test() {
ASSERT.equal(0x00, buffer[6]);
ASSERT.equal(0x00, buffer[7]);
- buffer.writeFloatBE(1/3, 0);
- buffer.writeFloatLE(1/3, 4);
+ buffer.writeFloatBE(1 / 3, 0);
+ buffer.writeFloatLE(1 / 3, 4);
ASSERT.equal(0x3e, buffer[0]);
ASSERT.equal(0xaa, buffer[1]);
ASSERT.equal(0xaa, buffer[2]);
@@ -50,8 +50,8 @@ function test() {
ASSERT.equal(0x7f, buffer[6]);
ASSERT.equal(0x7f, buffer[7]);
- buffer.writeFloatBE(0*-1, 0);
- buffer.writeFloatLE(0*-1, 4);
+ buffer.writeFloatBE(0 * -1, 0);
+ buffer.writeFloatLE(0 * -1, 4);
ASSERT.equal(0x80, buffer[0]);
ASSERT.equal(0x00, buffer[1]);
ASSERT.equal(0x00, buffer[2]);
diff --git a/test/simple/test-zlib.js b/test/simple/test-zlib.js
index 8b9467f3b9..b9267525ee 100644
--- a/test/simple/test-zlib.js
+++ b/test/simple/test-zlib.js
@@ -25,11 +25,11 @@ var zlib = require('zlib');
var path = require('path');
var zlibPairs =
- [ [zlib.Deflate, zlib.Inflate],
- [zlib.Gzip, zlib.Gunzip],
- [zlib.Deflate, zlib.Unzip],
- [zlib.Gzip, zlib.Unzip],
- [zlib.DeflateRaw, zlib.InflateRaw ] ];
+ [[zlib.Deflate, zlib.Inflate],
+ [zlib.Gzip, zlib.Gunzip],
+ [zlib.Deflate, zlib.Unzip],
+ [zlib.Gzip, zlib.Unzip],
+ [zlib.DeflateRaw, zlib.InflateRaw]];
// how fast to trickle through the slowstream
var trickle = [128, 1024, 1024 * 1024];
@@ -58,14 +58,14 @@ if (!process.env.PUMMEL) {
var fs = require('fs');
-var testFiles = [ 'person.jpg', 'elipses.txt', 'empty.txt' ];
+var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt'];
if (process.env.FAST) {
- zlibPairs = [ [zlib.Gzip, zlib.Unzip] ];
- var testFiles = [ 'person.jpg' ];
+ zlibPairs = [[zlib.Gzip, zlib.Unzip]];
+ var testFiles = ['person.jpg'];
}
-var tests = {}
+var tests = {};
testFiles.forEach(function(file) {
tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file));
});
@@ -141,7 +141,7 @@ SlowStream.prototype.resume = function() {
self.emit('data', c);
process.nextTick(emit);
}
-}
+};
SlowStream.prototype.end = function(chunk) {
// walk over the chunk in blocks.
@@ -164,62 +164,62 @@ var done = 0;
Object.keys(tests).forEach(function(file) {
var test = tests[file];
chunkSize.forEach(function(chunkSize) {
- trickle.forEach(function(trickle) {
- windowBits.forEach(function(windowBits) {
- level.forEach(function(level) {
- memLevel.forEach(function(memLevel) {
- strategy.forEach(function(strategy) {
- zlibPairs.forEach(function(pair) {
- var Def = pair[0];
- var Inf = pair[1];
- var opts = { level: level,
- windowBits: windowBits,
- memLevel: memLevel,
- strategy: strategy };
-
- total ++;
-
- var def = new Def(opts);
- var inf = new Inf(opts);
- var ss = new SlowStream(trickle);
- var buf = new BufferStream();
-
- // verify that the same exact buffer comes out the other end.
- buf.on('data', function(c) {
- var msg = file + ' ' +
- chunkSize + ' ' +
- JSON.stringify(opts) + ' ' +
- Def.name + ' -> ' + Inf.name;
- var ok = true;
- var testNum = ++done;
- for (var i = 0; i < Math.max(c.length, test.length); i++) {
- if (c[i] !== test[i]) {
- ok = false;
- failures ++;
- break;
- }
- }
- if (ok) {
- console.log('ok ' + (testNum) + ' ' + msg);
- } else {
- console.log('not ok ' + (testNum) + ' ' + msg);
- console.log(' ...');
- console.log(' testfile: ' + file);
- console.log(' type: ' + Def.name + ' -> ' + Inf.name);
- console.log(' position: ' + i);
- console.log(' options: ' + JSON.stringify(opts));
- console.log(' expect: ' + test[i]);
- console.log(' actual: ' + c[i]);
- console.log(' chunkSize: ' + chunkSize);
- console.log(' ---');
- }
- });
-
- // the magic happens here.
- ss.pipe(def).pipe(inf).pipe(buf);
- ss.end(test);
- });
- }); }); }); }); }); }); // sad stallman is sad.
+ trickle.forEach(function(trickle) {
+ windowBits.forEach(function(windowBits) {
+ level.forEach(function(level) {
+ memLevel.forEach(function(memLevel) {
+ strategy.forEach(function(strategy) {
+ zlibPairs.forEach(function(pair) {
+ var Def = pair[0];
+ var Inf = pair[1];
+ var opts = { level: level,
+ windowBits: windowBits,
+ memLevel: memLevel,
+ strategy: strategy };
+
+ total++;
+
+ var def = new Def(opts);
+ var inf = new Inf(opts);
+ var ss = new SlowStream(trickle);
+ var buf = new BufferStream();
+
+ // verify that the same exact buffer comes out the other end.
+ buf.on('data', function(c) {
+ var msg = file + ' ' +
+ chunkSize + ' ' +
+ JSON.stringify(opts) + ' ' +
+ Def.name + ' -> ' + Inf.name;
+ var ok = true;
+ var testNum = ++done;
+ for (var i = 0; i < Math.max(c.length, test.length); i++) {
+ if (c[i] !== test[i]) {
+ ok = false;
+ failures++;
+ break;
+ }
+ }
+ if (ok) {
+ console.log('ok ' + (testNum) + ' ' + msg);
+ } else {
+ console.log('not ok ' + (testNum) + ' ' + msg);
+ console.log(' ...');
+ console.log(' testfile: ' + file);
+ console.log(' type: ' + Def.name + ' -> ' + Inf.name);
+ console.log(' position: ' + i);
+ console.log(' options: ' + JSON.stringify(opts));
+ console.log(' expect: ' + test[i]);
+ console.log(' actual: ' + c[i]);
+ console.log(' chunkSize: ' + chunkSize);
+ console.log(' ---');
+ }
+ });
+
+ // the magic happens here.
+ ss.pipe(def).pipe(inf).pipe(buf);
+ ss.end(test);
+ });
+ }); }); }); }); }); }); // sad stallman is sad.
});
process.on('exit', function(code) {