summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_debugger.js16
-rw-r--r--lib/child_process.js44
-rw-r--r--lib/cluster.js10
-rw-r--r--lib/dns.js2
-rw-r--r--lib/fs.js66
-rw-r--r--lib/http.js43
-rw-r--r--lib/https.js4
-rw-r--r--lib/net.js21
-rw-r--r--lib/os.js3
-rw-r--r--lib/path.js20
-rw-r--r--lib/querystring.js6
-rw-r--r--lib/repl.js46
-rw-r--r--lib/tls.js5
-rw-r--r--lib/zlib.js2
-rw-r--r--test/common.js5
-rw-r--r--test/fixtures/catch-stdout-error.js4
-rw-r--r--test/message/throw_custom_error.js2
-rw-r--r--test/message/throw_non_error.js2
-rw-r--r--test/pummel/test-tls-ci-reneg-attack.js4
-rw-r--r--test/simple/test-assert.js2
-rw-r--r--test/simple/test-child-process-disconnect.js18
-rw-r--r--test/simple/test-child-process-double-pipe.js5
-rw-r--r--test/simple/test-child-process-silent.js3
-rw-r--r--test/simple/test-cluster-master-error.js6
-rw-r--r--test/simple/test-cluster-setup-master.js3
-rw-r--r--test/simple/test-crypto-padding.js27
-rw-r--r--test/simple/test-crypto.js238
-rw-r--r--test/simple/test-debugger-client.js19
-rw-r--r--test/simple/test-debugger-repl.js2
-rw-r--r--test/simple/test-dgram-broadcast-multi-process.js83
-rw-r--r--test/simple/test-dgram-multicast-multi-process.js86
-rw-r--r--test/simple/test-dgram-multicast-setTTL.js4
-rw-r--r--test/simple/test-eio-limit.js2
-rw-r--r--test/simple/test-fs-append-file-sync.js6
-rw-r--r--test/simple/test-fs-append-file.js9
-rw-r--r--test/simple/test-fs-exists.js4
-rw-r--r--test/simple/test-fs-open-flags.js48
-rw-r--r--test/simple/test-fs-watch.js6
-rw-r--r--test/simple/test-http-date-header.js51
-rw-r--r--test/simple/test-http-max-headers-count.js4
-rw-r--r--test/simple/test-http-parser-bad-ref.js8
-rw-r--r--test/simple/test-http-parser.js250
-rw-r--r--test/simple/test-http-should-keep-alive.js4
-rw-r--r--test/simple/test-https-client-reject.js2
-rw-r--r--test/simple/test-net-connect-buffer.js22
-rw-r--r--test/simple/test-net-dns-error.js2
-rw-r--r--test/simple/test-net-settimeout.js2
-rw-r--r--test/simple/test-net-write-after-close.js9
-rw-r--r--test/simple/test-querystring.js10
-rw-r--r--test/simple/test-regress-GH-877.js2
-rw-r--r--test/simple/test-repl-tab-complete.js2
-rw-r--r--test/simple/test-require-exceptions.js4
-rw-r--r--test/simple/test-script-context.js4
-rw-r--r--test/simple/test-stdout-close-catch.js2
-rw-r--r--test/simple/test-timers-zero-timeout.js2
-rw-r--r--test/simple/test-tls-client-reject.js2
-rw-r--r--test/simple/test-tls-client-resume.js3
-rw-r--r--test/simple/test-tls-over-http-tunnel.js10
-rw-r--r--test/simple/test-typed-arrays.js2
-rw-r--r--test/simple/test-util-inspect.js16
-rw-r--r--test/simple/test-zlib-invalid-input.js4
61 files changed, 750 insertions, 543 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js
index 8bd356d744..bdfc3743fa 100644
--- a/lib/_debugger.js
+++ b/lib/_debugger.js
@@ -112,8 +112,8 @@ Protocol.prototype.execute = function(d) {
this.state = 'body';
- if (Buffer.byteLength(res.raw, 'utf8') - this.bodyStartByteIndex
- < this.contentLength) {
+ var len = Buffer.byteLength(res.raw, 'utf8');
+ if (len - this.bodyStartByteIndex < this.contentLength) {
break;
}
// pass thru
@@ -125,16 +125,16 @@ Protocol.prototype.execute = function(d) {
buf.write(res.raw, 0, resRawByteLength, 'utf8');
res.body =
buf.slice(this.bodyStartByteIndex,
- this.bodyStartByteIndex
- + this.contentLength).toString('utf8');
+ this.bodyStartByteIndex +
+ this.contentLength).toString('utf8');
// JSON parse body?
res.body = res.body.length ? JSON.parse(res.body) : {};
// Done!
this.onResponse(res);
- this._newRes(buf.slice(this.bodyStartByteIndex
- + this.contentLength).toString('utf8'));
+ this._newRes(buf.slice(this.bodyStartByteIndex +
+ this.contentLength).toString('utf8'));
}
break;
@@ -149,8 +149,8 @@ Protocol.prototype.serialize = function(req) {
req.type = 'request';
req.seq = this.reqSeq++;
var json = JSON.stringify(req);
- return 'Content-Length: ' + Buffer.byteLength(json,'utf8') + '\r\n\r\n'
- + json;
+ return 'Content-Length: ' + Buffer.byteLength(json, 'utf8') +
+ '\r\n\r\n' + json;
};
diff --git a/lib/child_process.js b/lib/child_process.js
index 4b5cbbe673..9892c5cff2 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -115,7 +115,7 @@ function setupChannel(target, channel) {
throw new TypeError('message cannot be undefined');
}
- if (!this.connected) throw new Error("channel closed");
+ if (!this.connected) throw new Error('channel closed');
// For overflow protection don't write if channel queue is too deep.
if (channel.writeQueueSize > 1024 * 1024) {
@@ -140,33 +140,33 @@ function setupChannel(target, channel) {
target.connected = true;
target.disconnect = function() {
- if (!this.connected) {
- this.emit('error', new Error('IPC channel is already disconnected'));
- return;
- }
+ if (!this.connected) {
+ this.emit('error', new Error('IPC channel is already disconnected'));
+ return;
+ }
- // do not allow messages to be written
- this.connected = false;
- this._channel = null;
+ // do not allow messages to be written
+ this.connected = false;
+ this._channel = null;
- var fired = false;
- function finish() {
- if (fired) return;
- fired = true;
+ var fired = false;
+ function finish() {
+ if (fired) return;
+ fired = true;
- channel.close();
- target.emit('disconnect');
- }
+ channel.close();
+ target.emit('disconnect');
+ }
- // If a message is being read, then wait for it to complete.
- if (channel.buffering) {
- this.once('message', finish);
- this.once('internalMessage', finish);
+ // If a message is being read, then wait for it to complete.
+ if (channel.buffering) {
+ this.once('message', finish);
+ this.once('internalMessage', finish);
- return;
- }
+ return;
+ }
- finish();
+ finish();
};
channel.readStart();
diff --git a/lib/cluster.js b/lib/cluster.js
index 205df81466..8a29f9ac6b 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -90,12 +90,12 @@ function eachWorker(cb) {
}
cluster.setupMaster = function(options) {
- // This can only be called from the master.
- assert(cluster.isMaster);
+ // This can only be called from the master.
+ assert(cluster.isMaster);
// Don't allow this function to run more that once
- if (masterStarted) return;
- masterStarted = true;
+ if (masterStarted) return;
+ masterStarted = true;
// Get filename and arguments
options = options || {};
@@ -122,7 +122,7 @@ cluster.setupMaster = function(options) {
quickDestroyCluster();
// when done exit process with error code: 1
process.exit(1);
- });
+ });
// emit setup event
cluster.emit('setup');
diff --git a/lib/dns.js b/lib/dns.js
index 4be48ee672..834310810f 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -32,7 +32,7 @@ function errnoException(errorno, syscall) {
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
if (errorno == 'ENOENT') {
- errorno = 'ENOTFOUND'
+ errorno = 'ENOTFOUND';
}
e.errno = e.code = errorno;
diff --git a/lib/fs.js b/lib/fs.js
index 09a3dcb8ae..1a76564e07 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -37,18 +37,18 @@ var EventEmitter = require('events').EventEmitter;
var kMinPoolSpace = 128;
var kPoolSize = 40 * 1024;
-var O_APPEND = constants.O_APPEND || 0;
-var O_CREAT = constants.O_CREAT || 0;
+var O_APPEND = constants.O_APPEND || 0;
+var O_CREAT = constants.O_CREAT || 0;
var O_DIRECTORY = constants.O_DIRECTORY || 0;
-var O_EXCL = constants.O_EXCL || 0;
-var O_NOCTTY = constants.O_NOCTTY || 0;
-var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
-var O_RDONLY = constants.O_RDONLY || 0;
-var O_RDWR = constants.O_RDWR || 0;
-var O_SYMLINK = constants.O_SYMLINK || 0;
-var O_SYNC = constants.O_SYNC || 0;
-var O_TRUNC = constants.O_TRUNC || 0;
-var O_WRONLY = constants.O_WRONLY || 0;
+var O_EXCL = constants.O_EXCL || 0;
+var O_NOCTTY = constants.O_NOCTTY || 0;
+var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
+var O_RDONLY = constants.O_RDONLY || 0;
+var O_RDWR = constants.O_RDWR || 0;
+var O_SYMLINK = constants.O_SYMLINK || 0;
+var O_SYNC = constants.O_SYNC || 0;
+var O_TRUNC = constants.O_TRUNC || 0;
+var O_WRONLY = constants.O_WRONLY || 0;
fs.Stats = binding.Stats;
@@ -199,10 +199,10 @@ function stringToFlags(flag) {
}
switch (flag) {
- case 'r' : return O_RDONLY;
+ case 'r' : return O_RDONLY;
case 'r+' : return O_RDWR;
- case 'w' : return O_TRUNC | O_CREAT | O_WRONLY;
+ case 'w' : return O_TRUNC | O_CREAT | O_WRONLY;
case 'wx' : // fall through
case 'xw' : return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL;
@@ -210,7 +210,7 @@ function stringToFlags(flag) {
case 'wx+': // fall through
case 'xw+': return O_TRUNC | O_CREAT | O_RDWR | O_EXCL;
- case 'a' : return O_APPEND | O_CREAT | O_WRONLY;
+ case 'a' : return O_APPEND | O_CREAT | O_WRONLY;
case 'ax' : // fall through
case 'xa' : return O_APPEND | O_CREAT | O_WRONLY | O_EXCL;
@@ -262,8 +262,10 @@ fs.open = function(path, flags, mode, callback) {
mode = modeNum(mode, 438 /*=0666*/);
- binding.open(pathModule._makeLong(path), stringToFlags(flags), mode,
- callback);
+ binding.open(pathModule._makeLong(path),
+ stringToFlags(flags),
+ mode,
+ callback);
};
fs.openSync = function(path, flags, mode) {
@@ -363,13 +365,14 @@ fs.writeSync = function(fd, buffer, offset, length, position) {
};
fs.rename = function(oldPath, newPath, callback) {
- binding.rename(pathModule._makeLong(oldPath), pathModule._makeLong(newPath),
- callback || noop);
+ binding.rename(pathModule._makeLong(oldPath),
+ pathModule._makeLong(newPath),
+ callback || noop);
};
fs.renameSync = function(oldPath, newPath) {
return binding.rename(pathModule._makeLong(oldPath),
- pathModule._makeLong(newPath));
+ pathModule._makeLong(newPath));
};
fs.truncate = function(fd, len, callback) {
@@ -407,12 +410,12 @@ fs.fsyncSync = function(fd) {
fs.mkdir = function(path, mode, callback) {
if (typeof mode === 'function') callback = mode;
binding.mkdir(pathModule._makeLong(path), modeNum(mode, 511 /*=0777*/),
- callback || noop);
+ callback || noop);
};
fs.mkdirSync = function(path, mode) {
return binding.mkdir(pathModule._makeLong(path),
- modeNum(mode, 511 /*=0777*/));
+ modeNum(mode, 511 /*=0777*/));
};
fs.sendfile = function(outFd, inFd, inOffset, length, callback) {
@@ -468,22 +471,23 @@ fs.symlink = function(destination, path, type_, callback) {
var callback_ = arguments[arguments.length - 1];
callback = (typeof(callback_) == 'function' ? callback_ : null);
binding.symlink(pathModule._makeLong(destination),
- pathModule._makeLong(path), type, callback);
+ pathModule._makeLong(path), type, callback);
};
fs.symlinkSync = function(destination, path, type) {
return binding.symlink(pathModule._makeLong(destination),
- pathModule._makeLong(path), type);
+ pathModule._makeLong(path), type);
};
fs.link = function(srcpath, dstpath, callback) {
- binding.link(pathModule._makeLong(srcpath), pathModule._makeLong(dstpath),
- callback || noop);
+ binding.link(pathModule._makeLong(srcpath),
+ pathModule._makeLong(dstpath),
+ callback || noop);
};
fs.linkSync = function(srcpath, dstpath) {
return binding.link(pathModule._makeLong(srcpath),
- pathModule._makeLong(dstpath));
+ pathModule._makeLong(dstpath));
};
fs.unlink = function(path, callback) {
@@ -637,7 +641,10 @@ function writeAll(fd, buffer, offset, length, position, callback) {
if (written === length) {
fs.close(fd, callback);
} else {
- writeAll(fd, buffer, offset + written, length - written, position + written, callback);
+ offset += written;
+ length -= written;
+ position += written;
+ writeAll(fd, buffer, offset, length, position, callback);
}
}
});
@@ -1462,7 +1469,8 @@ function SyncWriteStream(fd) {
this.fd = fd;
this.writable = true;
this.readable = false;
-};
+}
+
util.inherits(SyncWriteStream, Stream);
@@ -1481,7 +1489,7 @@ SyncWriteStream.prototype.write = function(data, arg1, arg2) {
} else if (typeof arg1 === 'function') {
cb = arg1;
} else {
- throw new Error("bad arg");
+ throw new Error('bad arg');
}
}
diff --git a/lib/http.js b/lib/http.js
index d800895a5a..91ba17ee56 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -232,10 +232,10 @@ var continueExpression = /100-continue/i;
var dateCache;
function utcDate() {
- if (! dateCache) {
+ if (!dateCache) {
var d = new Date();
dateCache = d.toUTCString();
- setTimeout(function () {
+ setTimeout(function() {
dateCache = undefined;
}, 1000 - d.getMilliseconds());
}
@@ -549,13 +549,16 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
// Date header
if (this.sendDate == true && sentDateHeader == false) {
- messageHeader += "Date: " + utcDate() + CRLF;
+ messageHeader += 'Date: ' + utcDate() + CRLF;
}
// keep-alive logic
if (sentConnectionHeader === false) {
- if (this.shouldKeepAlive &&
- (sentContentLengthHeader || this.useChunkedEncodingByDefault || this.agent)) {
+ var shouldSendKeepAlive = this.shouldKeepAlive &&
+ (sentContentLengthHeader ||
+ this.useChunkedEncodingByDefault ||
+ this.agent);
+ if (shouldSendKeepAlive) {
messageHeader += 'Connection: keep-alive\r\n';
} else {
this._last = true;
@@ -588,11 +591,11 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
OutgoingMessage.prototype.setHeader = function(name, value) {
if (arguments.length < 2) {
- throw new Error("`name` and `value` are required for setHeader().");
+ throw new Error('`name` and `value` are required for setHeader().');
}
if (this._header) {
- throw new Error("Can't set headers after they are sent.");
+ throw new Error('Can\'t set headers after they are sent.');
}
var key = name.toLowerCase();
@@ -605,7 +608,7 @@ OutgoingMessage.prototype.setHeader = function(name, value) {
OutgoingMessage.prototype.getHeader = function(name) {
if (arguments.length < 1) {
- throw new Error("`name` is required for getHeader().");
+ throw new Error('`name` is required for getHeader().');
}
if (!this._headers) return;
@@ -617,11 +620,11 @@ OutgoingMessage.prototype.getHeader = function(name) {
OutgoingMessage.prototype.removeHeader = function(name) {
if (arguments.length < 1) {
- throw new Error("`name` is required for removeHeader().");
+ throw new Error('`name` is required for removeHeader().');
}
if (this._header) {
- throw new Error("Can't remove headers after they are sent.");
+ throw new Error('Can\'t remove headers after they are sent.');
}
if (!this._headers) return;
@@ -634,7 +637,7 @@ OutgoingMessage.prototype.removeHeader = function(name) {
OutgoingMessage.prototype._renderHeaders = function() {
if (this._header) {
- throw new Error("Can't render headers after they are sent to the client.");
+ throw new Error('Can\'t render headers after they are sent to the client.');
}
if (!this._headers) return {};
@@ -1037,7 +1040,7 @@ Agent.prototype.createSocket = function(name, host, port) {
}
s.on('close', onClose);
var onRemove = function() {
- // We need this function for cases like HTTP "upgrade"
+ // We need this function for cases like HTTP 'upgrade'
// (defined by WebSockets) where we need to remove a socket from the pool
// because it'll be locked up indefinitely
self.removeSocket(s, name, host, port);
@@ -1145,10 +1148,11 @@ function ClientRequest(options, cb) {
self._last = true;
self.shouldKeepAlive = false;
if (options.createConnection) {
- self.onSocket(options.createConnection(options.port, options.host, options));
+ var conn = options.createConnection(options.port, options.host, options);
} else {
- self.onSocket(net.createConnection(options.port, options.host));
+ var conn = net.createConnection(options.port, options.host);
}
+ self.onSocket(conn);
}
self._deferToConnect(null, null, function() {
@@ -1161,7 +1165,8 @@ util.inherits(ClientRequest, OutgoingMessage);
exports.ClientRequest = ClientRequest;
ClientRequest.prototype._implicitHeader = function() {
- this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n', this._renderHeaders());
+ this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
+ this._renderHeaders());
};
ClientRequest.prototype.abort = function() {
@@ -1204,7 +1209,7 @@ ClientRequest.prototype.onSocket = function(socket) {
}
socket._httpMessage = req;
- // Setup "drain" propogation.
+ // Setup 'drain' propogation.
httpSocketSetup(socket);
var freeParser = function() {
@@ -1290,7 +1295,7 @@ ClientRequest.prototype.onSocket = function(socket) {
debug('HTTP socket close');
req.emit('close');
if (req.res && req.res.readable) {
- // Socket closed before we emitted "end" below.
+ // Socket closed before we emitted 'end' below.
req.res.emit('aborted');
req.res.emit('end');
req.res.emit('close');
@@ -1661,7 +1666,7 @@ Client.prototype.request = function(method, path, headers) {
c.on('error', function(e) {
self.emit('error', e);
});
- // The old Client interface emitted "end" on socket end.
+ // The old Client interface emitted 'end' on socket end.
// This doesn't map to how we want things to operate in the future
// but it will get removed when we remove this legacy interface.
c.on('socket', function(s) {
@@ -1675,7 +1680,7 @@ Client.prototype.request = function(method, path, headers) {
exports.Client = Client;
// TODO http.Client can be removed in v0.9. Until then leave this message.
-module.deprecate('Client', 'It will be removed in the near future. Do not use it.');
+module.deprecate('Client', 'It will be removed soon. Do not use it.');
exports.createClient = function(port, host) {
return new Client(port, host);
diff --git a/lib/https.js b/lib/https.js
index 991c63c298..bda03733a3 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -55,12 +55,12 @@ function createConnection(port, host, options) {
options.port = port;
options.host = host;
return tls.connect(options);
-};
+}
function Agent(options) {
http.Agent.call(this, options);
this.createConnection = createConnection;
-};
+}
inherits(Agent, http.Agent);
Agent.prototype.defaultPort = 443;
diff --git a/lib/net.js b/lib/net.js
index 4630de7cbf..9d51855363 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -25,7 +25,7 @@ var timers = require('timers');
var util = require('util');
var assert = require('assert');
-function noop() {};
+function noop() {}
// constructor for lazy loading
function createPipe() {
@@ -178,7 +178,7 @@ Socket.prototype.setTimeout = function(msecs, callback) {
Socket.prototype._onTimeout = function() {
- debug("_onTimeout");
+ debug('_onTimeout');
this.emit('timeout');
};
@@ -449,7 +449,7 @@ Socket.prototype.write = function(data, arg1, arg2) {
} else if (typeof arg1 === 'function') {
cb = arg1;
} else {
- throw new Error("bad arg");
+ throw new Error('bad arg');
}
}
@@ -457,7 +457,7 @@ Socket.prototype.write = function(data, arg1, arg2) {
if (typeof data === 'string') {
data = new Buffer(data, encoding);
} else if (!Buffer.isBuffer(data)) {
- throw new TypeError("First argument must be a buffer or a string.");
+ throw new TypeError('First argument must be a buffer or a string.');
}
this.bytesWritten += data.length;
@@ -782,12 +782,13 @@ Server.prototype._listen2 = function(address, port, addressType) {
process.nextTick(function() {
self.emit('listening');
});
-}
+};
function listen(self, address, port, addressType) {
if (process.env.NODE_UNIQUE_ID) {
- require('cluster')._getServer(self, address, port, addressType, function(handle) {
+ var cluster = require('cluster');
+ cluster._getServer(self, address, port, addressType, function(handle) {
self._handle = handle;
self._listen2(address, port, addressType);
});
@@ -958,14 +959,14 @@ if (process.platform === 'win32') {
if (typeof simultaneousAccepts === 'undefined') {
simultaneousAccepts = (process.env.NODE_MANY_ACCEPTS &&
- process.env.NODE_MANY_ACCEPTS != '0') ? true : false;
+ process.env.NODE_MANY_ACCEPTS !== '0');
}
- if (handle._simultaneousAccepts != simultaneousAccepts) {
+ if (handle._simultaneousAccepts !== simultaneousAccepts) {
handle.setSimultaneousAccepts(simultaneousAccepts);
handle._simultaneousAccepts = simultaneousAccepts;
}
- }
+ };
} else {
- exports._setSimultaneousAccepts = function(handle) {}
+ exports._setSimultaneousAccepts = function(handle) {};
}
diff --git a/lib/os.js b/lib/os.js
index 21a95a1359..8bd421b087 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -40,4 +40,5 @@ exports.platform = function() {
exports.getNetworkInterfaces = function() {
return exports.networkInterfaces();
};
-module.deprecate('getNetworkInterfaces', 'It is now called `os.networkInterfaces`.');
+module.deprecate('getNetworkInterfaces',
+ 'It is now called `os.networkInterfaces`.');
diff --git a/lib/path.js b/lib/path.js
index 0ca51e84f3..148b2af9a1 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -62,7 +62,8 @@ if (isWindows) {
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/;
// Regex to split the tail part of the above into [*, dir, basename, ext]
- var splitTailRe = /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/\\]*)?)$/;
+ var splitTailRe =
+ /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/\\]*)?)$/;
// Function to split a filename into [root, dir, basename, ext]
// windows version
@@ -262,7 +263,8 @@ if (isWindows) {
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
- var splitPathRe = /^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;
+ var splitPathRe =
+ /^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;
var splitPath = function(filename) {
var result = splitPathRe.exec(filename);
return [result[1] || '', result[2] || '', result[3] || '', result[4] || ''];
@@ -420,11 +422,11 @@ exports.existsSync = function(path) {
module.deprecate('existsSync', 'It is now called `fs.existsSync`.');
-exports._makeLong = isWindows ?
- function(path) {
- path = "" + path;
+if (isWindows) {
+ exports._makeLong = function(path) {
+ path = '' + path;
if (!path) {
- return "";
+ return '';
}
var resolvedPath = exports.resolve(path);
@@ -440,7 +442,9 @@ exports._makeLong = isWindows ?
}
return path;
- } :
- function(path) {
+ };
+} else {
+ exports._makeLong = function(path) {
return path;
};
+}
diff --git a/lib/querystring.js b/lib/querystring.js
index 467eabdea7..d7abc48993 100644
--- a/lib/querystring.js
+++ b/lib/querystring.js
@@ -185,12 +185,12 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
qs.forEach(function(kvp) {
var x = kvp.split(eq), k, v, useQS = false;
try {
- if (kvp.match(/\+/)) { // decodeURIComponent does not decode + to space
+ if (kvp.match(/\+/)) { // decodeURIComponent does not decode + to space
throw 'has +';
}
k = decodeURIComponent(x[0]);
- v = decodeURIComponent(x.slice(1).join(eq) || "");
- } catch(e) {
+ v = decodeURIComponent(x.slice(1).join(eq) || '');
+ } catch (e) {
k = QueryString.unescape(x[0], true);
v = QueryString.unescape(x.slice(1).join(eq), true);
}
diff --git a/lib/repl.js b/lib/repl.js
index 7bbc6d1448..70a5ebaf97 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -27,12 +27,12 @@
* repl.start("prompt> ");
*
* // listen for unix socket connections and start repl on them
- * net.createServer(function (socket) {
+ * net.createServer(function(socket) {
* repl.start("node via Unix socket> ", socket);
* }).listen("/tmp/node-repl-sock");
*
* // listen for TCP socket connections and start repl on them
- * net.createServer(function (socket) {
+ * net.createServer(function(socket) {
* repl.start("node via TCP socket> ", socket);
* }).listen(5001);
*
@@ -285,9 +285,13 @@ REPLServer.prototype.resetContext = function(force) {
};
REPLServer.prototype.displayPrompt = function(preserveCursor) {
- this.rli.setPrompt(this.bufferedCommand.length ?
- '...' + new Array(this.lines.level.length).join('..') + ' ' :
- this.prompt);
+ var prompt = this.prompt;
+ if (this.bufferedCommand.length) {
+ prompt = '...';
+ var levelInd = new Array(this.lines.level.length).join('..');
+ prompt += levelInd + ' ';
+ }
+ this.rli.setPrompt(prompt);
this.rli.prompt(preserveCursor);
};
@@ -299,9 +303,9 @@ REPLServer.prototype.readline = function(cmd) {
// A stream to push an array into a REPL
// used in REPLServer.complete
function ArrayStream() {
- this.run = function (data) {
+ this.run = function(data) {
var self = this;
- data.forEach(function (line) {
+ data.forEach(function(line) {
self.emit('data', line);
});
}
@@ -309,8 +313,8 @@ function ArrayStream() {
util.inherits(ArrayStream, require('stream').Stream);
ArrayStream.prototype.readable = true;
ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function () {};
-ArrayStream.prototype.write = function () {};
+ArrayStream.prototype.resume = function() {};
+ArrayStream.prototype.write = function() {};
var requireRE = /\brequire\s*\(['"](([\w\.\/-]+\/)?([\w\.\/-]*))/;
var simpleExpressionRE =
@@ -334,7 +338,7 @@ REPLServer.prototype.complete = function(line, callback) {
var tmp = this.lines.slice();
// Kill off all function declarations to push all local variables into
// global scope
- this.lines.level.forEach(function (kill) {
+ this.lines.level.forEach(function(kill) {
if (kill.isFunction) {
tmp[kill.line] = '';
}
@@ -637,7 +641,7 @@ REPLServer.prototype.defineCommand = function(keyword, cmd) {
this.commands['.' + keyword] = cmd;
};
-REPLServer.prototype.memory = function memory (cmd) {
+REPLServer.prototype.memory = function memory(cmd) {
var self = this;
self.lines = self.lines || [];
@@ -656,7 +660,7 @@ REPLServer.prototype.memory = function memory (cmd) {
// Because I can not tell the difference between a } that
// closes an object literal and a } that closes a function
if (cmd) {
- // going down is { and ( e.g. function () {
+ // going down is { and ( e.g. function() {
// going up is } and )
var dw = cmd.match(/{|\(/g);
var up = cmd.match(/}|\)/g);
@@ -665,18 +669,20 @@ REPLServer.prototype.memory = function memory (cmd) {
var depth = dw - up;
if (depth) {
- (function workIt(){
+ (function workIt() {
if (depth > 0) {
// going... down.
// push the line#, depth count, and if the line is a function.
// Since JS only has functional scope I only need to remove
- // "function () {" lines, clearly this will not work for
- // "function ()
+ // "function() {" lines, clearly this will not work for
+ // "function()
// {" but nothing should break, only tab completion for local
// scope will not work for this function.
- self.lines.level.push({ line: self.lines.length - 1,
- depth: depth,
- isFunction: /\s*function\s*/.test(cmd)});
+ self.lines.level.push({
+ line: self.lines.length - 1,
+ depth: depth,
+ isFunction: /\s*function\s*/.test(cmd)
+ });
} else if (depth < 0) {
// going... up.
var curr = self.lines.level.pop();
@@ -763,7 +769,7 @@ function defineDefaultCommands(repl) {
fs.writeFileSync(file, this.lines.join('\n') + '\n');
this.outputStream.write('Session saved to:' + file + '\n');
} catch (e) {
- this.outputStream.write('Failed to save:' + file+ '\n')
+ this.outputStream.write('Failed to save:' + file + '\n');
}
this.displayPrompt();
}
@@ -779,7 +785,7 @@ function defineDefaultCommands(repl) {
var data = fs.readFileSync(file, 'utf8');
var lines = data.split('\n');
this.displayPrompt();
- lines.forEach(function (line) {
+ lines.forEach(function(line) {
if (line) {
self.rli.write(line + '\n');
}
diff --git a/lib/tls.js b/lib/tls.js
index d951ef358b..4d7da1dde4 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -31,7 +31,7 @@ var assert = require('assert').ok;
// every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more
// renegotations are seen. The settings are applied to all remote client
// connections.
-exports.CLIENT_RENEG_LIMIT = 3;
+exports.CLIENT_RENEG_LIMIT = 3;
exports.CLIENT_RENEG_WINDOW = 600;
@@ -903,6 +903,8 @@ function Server(/* [options], listener */) {
if (!(this instanceof Server)) return new Server(options, listener);
+ this._contexts = [];
+
var self = this;
// Handle option defaults:
@@ -1018,7 +1020,6 @@ Server.prototype.setOptions = function(options) {
};
// SNI Contexts High-Level API
-Server.prototype._contexts = [];
Server.prototype.addContext = function(servername, credentials) {
if (!servername) {
throw 'Servername is required parameter for Server.addContext';
diff --git a/lib/zlib.js b/lib/zlib.js
index 349c5c64d9..1100a83947 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -135,7 +135,7 @@ function zlibBuffer(engine, buffer, callback) {
function onEnd() {
var buffer;
- switch(buffers.length) {
+ switch (buffers.length) {
case 0:
buffer = new Buffer(0);
break;
diff --git a/test/common.js b/test/common.js
index 202d1fa9bc..2656c91b38 100644
--- a/test/common.js
+++ b/test/common.js
@@ -54,8 +54,9 @@ exports.indirectInstanceOf = function(obj, cls) {
exports.ddCommand = function(filename, kilobytes) {
if (process.platform == 'win32') {
- return '"' + process.argv[0] + '" "' + path.resolve(exports.fixturesDir,
- 'create-file.js') + '" "' + filename + '" ' + (kilobytes * 1024);
+ var p = path.resolve(exports.fixturesDir, 'create-file.js');
+ return '"' + process.argv[0] + '" "' + p + '" "' +
+ filename + '" ' + (kilobytes * 1024);
} else {
return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes;
}
diff --git a/test/fixtures/catch-stdout-error.js b/test/fixtures/catch-stdout-error.js
index 6f96ae9e35..a244946148 100644
--- a/test/fixtures/catch-stdout-error.js
+++ b/test/fixtures/catch-stdout-error.js
@@ -25,12 +25,12 @@ function write() {
} catch (ex) {
throw new Error('this should never happen');
}
- process.nextTick(function () {
+ process.nextTick(function() {
write();
});
}
-process.stdout.on('error', function (er) {
+process.stdout.on('error', function(er) {
console.error(JSON.stringify(er));
process.exit(42);
});
diff --git a/test/message/throw_custom_error.js b/test/message/throw_custom_error.js
index bef7f5dab0..b92298d864 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 afea96f49c..defa0791e6 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-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js
index 5d04a6b6f3..e9748c116f 100644
--- a/test/pummel/test-tls-ci-reneg-attack.js
+++ b/test/pummel/test-tls-ci-reneg-attack.js
@@ -29,7 +29,7 @@ var fs = require('fs');
var LIMITS = [0, 1, 2, 3, 5, 10, 16];
if (process.platform === 'win32') {
- console.log("Skipping test, you probably don't have openssl installed.");
+ console.log('Skipping test, you probably don\'t have openssl installed.');
process.exit();
}
@@ -93,7 +93,7 @@ function test(next) {
// simulate renegotiation attack
function spam() {
if (closed) return;
- child.stdin.write("R\n");
+ child.stdin.write('R\n');
setTimeout(spam, 250);
}
});
diff --git a/test/simple/test-assert.js b/test/simple/test-assert.js
index 84c333b574..13c7e494e1 100644
--- a/test/simple/test-assert.js
+++ b/test/simple/test-assert.js
@@ -214,7 +214,7 @@ threw = false;
try {
assert.throws(
function() {
- throw {};
+ throw ({});
},
Array
);
diff --git a/test/simple/test-child-process-disconnect.js b/test/simple/test-child-process-disconnect.js
index e490c0848d..2136aaf3e6 100644
--- a/test/simple/test-child-process-disconnect.js
+++ b/test/simple/test-child-process-disconnect.js
@@ -29,15 +29,15 @@ if (process.argv[2] === 'child') {
var server = net.createServer();
- server.on('connection', function (socket) {
+ server.on('connection', function(socket) {
- process.on('disconnect', function () {
+ process.on('disconnect', function() {
socket.end((process.connected).toString());
});
// when the socket is closed, we will close the server
// allowing the process to self terminate
- socket.on('end', function () {
+ socket.on('end', function() {
server.close();
});
@@ -45,7 +45,7 @@ if (process.argv[2] === 'child') {
});
// when the server is ready tell parent
- server.on('listening', function () {
+ server.on('listening', function() {
process.send('ready');
});
@@ -62,24 +62,24 @@ if (process.argv[2] === 'child') {
// when calling .disconnect the event should emit
// and the disconnected flag should be true.
- child.on('disconnect', function () {
+ child.on('disconnect', function() {
parentEmit = true;
parentFlag = child.connected;
});
// the process should also self terminate without using signals
- child.on('exit', function () {
+ child.on('exit', function() {
childSelfTerminate = true;
});
// when child is listning
- child.on('message', function (msg) {
+ child.on('message', function(msg) {
if (msg === 'ready') {
// connect to child using TCP to know if disconnect was emitted
var socket = net.connect(common.PORT);
- socket.on('data', function (data) {
+ socket.on('data', function(data) {
data = data.toString();
// ready to be disconnected
@@ -96,7 +96,7 @@ if (process.argv[2] === 'child') {
}
});
- process.on('exit', function () {
+ process.on('exit', function() {
assert.equal(childFlag, false);
assert.equal(parentFlag, false);
diff --git a/test/simple/test-child-process-double-pipe.js b/test/simple/test-child-process-double-pipe.js
index b0fc11d33f..a2253666e9 100644
--- a/test/simple/test-child-process-double-pipe.js
+++ b/test/simple/test-child-process-double-pipe.js
@@ -33,8 +33,9 @@ var grep = spawn('grep', ['o']),
echo;
if (is_windows) {
- echo = spawn('cmd.exe', ['/c', 'echo', 'hello&&', 'echo',
- 'node&&', 'echo', 'and&&', 'echo', 'world']);
+ echo = spawn('cmd.exe',
+ ['/c', 'echo', 'hello&&', 'echo',
+ 'node&&', 'echo', 'and&&', 'echo', 'world']);
} else {
echo = spawn('echo', ['hello\nnode\nand\nworld\n']);
}
diff --git a/test/simple/test-child-process-silent.js b/test/simple/test-child-process-silent.js
index f438bf47e9..e34daa3a83 100644
--- a/test/simple/test-child-process-silent.js
+++ b/test/simple/test-child-process-silent.js
@@ -52,7 +52,8 @@ if (process.argv[2] === 'pipetest') {
// testcase | start parent && child IPC test
// testing: is stderr and stdout piped to parent
- var parent = childProcess.spawn(process.execPath, [process.argv[1], 'parent']);
+ var args = [process.argv[1], 'parent'];
+ var parent = childProcess.spawn(process.execPath, args);
//got any stderr or std data
var stdoutData = false;
diff --git a/test/simple/test-cluster-master-error.js b/test/simple/test-cluster-master-error.js
index 4add0eba13..a9b9896179 100644
--- a/test/simple/test-cluster-master-error.js
+++ b/test/simple/test-cluster-master-error.js
@@ -125,8 +125,10 @@ if (cluster.isWorker) {
});
process.once('exit', function() {
- assert.ok(existMaster, 'The master did not die after an error was throwed');
- assert.ok(existWorker, 'The workers did not die after an error in the master');
+ var m = 'The master did not die after an error was throwed';
+ assert.ok(existMaster, m);
+ m = 'The workers did not die after an error in the master';
+ assert.ok(existWorker, m);
});
}
diff --git a/test/simple/test-cluster-setup-master.js b/test/simple/test-cluster-setup-master.js
index 7f542e4e68..7dbbc322c6 100644
--- a/test/simple/test-cluster-setup-master.js
+++ b/test/simple/test-cluster-setup-master.js
@@ -83,7 +83,8 @@ if (cluster.isWorker) {
process.once('exit', function() {
assert.ok(checks.args, 'The arguments was noy send to the worker');
assert.ok(checks.setupEvent, 'The setup event was never emitted');
- assert.ok(checks.settingsObject, 'The settingsObject do not have correct properties');
+ var m = 'The settingsObject do not have correct properties';
+ assert.ok(checks.settingsObject, m);
});
}
diff --git a/test/simple/test-crypto-padding.js b/test/simple/test-crypto-padding.js
index 55bd94e00d..f3f6632176 100644
--- a/test/simple/test-crypto-padding.js
+++ b/test/simple/test-crypto-padding.js
@@ -47,14 +47,25 @@ var CIPHER_NAME = 'aes-128-cbc';
* Expected result data
*/
-// echo -n 'Hello node world!' | openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 -iv 626c616846697a7a3230313142757a7a | xxd -p -c256
-var ODD_LENGTH_ENCRYPTED = '7f57859550d4d2fdb9806da2a750461a9fe77253cd1cbd4b07beee4e070d561f';
-
-// echo -n 'Hello node world!AbC09876dDeFgHi' | openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 -iv 626c616846697a7a3230313142757a7a | xxd -p -c256
-var EVEN_LENGTH_ENCRYPTED = '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b9886119866912cb8c7bcaf76c5ebc2378';
-
-// echo -n 'Hello node world!AbC09876dDeFgHi' | openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256
-var EVEN_LENGTH_ENCRYPTED_NOPAD = '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b9';
+// echo -n 'Hello node world!' | \
+// openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \
+// -iv 626c616846697a7a3230313142757a7a | xxd -p -c256
+var ODD_LENGTH_ENCRYPTED =
+ '7f57859550d4d2fdb9806da2a750461a9fe77253cd1cbd4b07beee4e070d561f';
+
+// echo -n 'Hello node world!AbC09876dDeFgHi' | \
+// openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \
+// -iv 626c616846697a7a3230313142757a7a | xxd -p -c256
+var EVEN_LENGTH_ENCRYPTED =
+ '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b988' +
+ '6119866912cb8c7bcaf76c5ebc2378';
+
+// echo -n 'Hello node world!AbC09876dDeFgHi' | \
+// openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \
+// -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256
+var EVEN_LENGTH_ENCRYPTED_NOPAD =
+ '7f57859550d4d2fdb9806da2a750461ab46e' +
+ '71b3d78ebe2d9684dfc87f7575b9';
/*
diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js
index cbccc72dad..800e3eb5ae 100644
--- a/test/simple/test-crypto.js
+++ b/test/simple/test-crypto.js
@@ -69,44 +69,80 @@ var rfc4231 = [
data: new Buffer('4869205468657265', 'hex'), // 'Hi There'
hmac: {
sha224: '896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22',
- sha256: 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7',
- sha384: 'afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6',
- sha512: '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854'
+ sha256:
+ 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c' +
+ '2e32cff7',
+ sha384:
+ 'afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c' +
+ '7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6',
+ sha512:
+ '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b305' +
+ '45e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f170' +
+ '2e696c203a126854'
}
},
{
key: new Buffer('4a656665', 'hex'), // 'Jefe'
- data: new Buffer('7768617420646f2079612077616e7420666f72206e6f7468696e673f', 'hex'), // 'what do ya want for nothing?'
+ data: new Buffer('7768617420646f2079612077616e7420666f72206e6f74686' +
+ '96e673f', 'hex'), // 'what do ya want for nothing?'
hmac: {
sha224: 'a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44',
- sha256: '5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843',
- sha384: 'af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649',
- sha512: '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737'
+ sha256:
+ '5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b9' +
+ '64ec3843',
+ sha384:
+ 'af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec373' +
+ '6322445e8e2240ca5e69e2c78b3239ecfab21649',
+ sha512:
+ '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7' +
+ 'ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b' +
+ '636e070a38bce737'
}
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: new Buffer('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
+ data: new Buffer('ddddddddddddddddddddddddddddddddddddddddddddddddd' +
+ 'ddddddddddddddddddddddddddddddddddddddddddddddddddd',
+ 'hex'),
hmac: {
sha224: '7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea',
- sha256: '773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe',
- sha384: '88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27',
- sha512: 'fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb'
+ sha256:
+ '773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514' +
+ 'ced565fe',
+ sha384:
+ '88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e5' +
+ '5966144b2a5ab39dc13814b94e3ab6e101a34f27',
+ sha512:
+ 'fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33' +
+ 'b2279d39bf3e848279a722c806b485a47e67c807b946a337bee89426' +
+ '74278859e13292fb'
}
},
{
- key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
- data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
+ key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819',
+ 'hex'),
+ data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' +
+ 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd',
+ 'hex'),
hmac: {
sha224: '6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a',
- sha256: '82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b',
- sha384: '3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb',
- sha512: 'b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd'
+ sha256:
+ '82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff4' +
+ '6729665b',
+ sha384:
+ '3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e' +
+ '1f573b4e6801dd23c4a7d679ccf8a386c674cffb',
+ sha512:
+ 'b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050' +
+ '361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2d' +
+ 'e2adebeb10a298dd'
}
},
+
{
key: new Buffer('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
- data: new Buffer('546573742057697468205472756e636174696f6e', 'hex'), // 'Test With Truncation'
+ // 'Test With Truncation'
+ data: new Buffer('546573742057697468205472756e636174696f6e', 'hex'),
hmac: {
sha224: '0e2aea68a90c8d37c988bcdb9fca6fa8',
sha256: 'a3b6167473100ee06e0c796c2955552b',
@@ -116,23 +152,59 @@ var rfc4231 = [
truncate: true
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: new Buffer('54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374', 'hex'), // 'Test Using Larger Than Block-Size Key - Hash Key First'
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaa', 'hex'),
+ // 'Test Using Larger Than Block-Size Key - Hash Key First'
+ data: new Buffer('54657374205573696e67204c6172676572205468616e20426' +
+ 'c6f636b2d53697a65204b6579202d2048617368204b657920' +
+ '4669727374', 'hex'),
hmac: {
sha224: '95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e',
- sha256: '60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54',
- sha384: '4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952',
- sha512: '80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598'
+ sha256:
+ '60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f' +
+ '0ee37f54',
+ sha384:
+ '4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05' +
+ '033ac4c60c2ef6ab4030fe8296248df163f44952',
+ sha512:
+ '80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b0137' +
+ '83f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec' +
+ '8b915a985d786598'
}
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: new Buffer('5468697320697320612074657374207573696e672061206c6172676572207468616e20626c6f636b2d73697a65206b657920616e642061206c6172676572207468616e20626c6f636b2d73697a6520646174612e20546865206b6579206e6565647320746f20626520686173686564206265666f7265206265696e6720757365642062792074686520484d414320616c676f726974686d2e', 'hex'), // 'This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.'
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaa', 'hex'),
+ // 'This is a test using a larger than block-size key and a larger ' +
+ // 'than block-size data. The key needs to be hashed before being ' +
+ // 'used by the HMAC algorithm.'
+ data: new Buffer('5468697320697320612074657374207573696e672061206c6' +
+ '172676572207468616e20626c6f636b2d73697a65206b6579' +
+ '20616e642061206c6172676572207468616e20626c6f636b2' +
+ 'd73697a6520646174612e20546865206b6579206e65656473' +
+ '20746f20626520686173686564206265666f7265206265696' +
+ 'e6720757365642062792074686520484d414320616c676f72' +
+ '6974686d2e', 'hex'),
hmac: {
sha224: '3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1',
- sha256: '9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2',
- sha384: '6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e',
- sha512: 'e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58'
+ sha256:
+ '9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f5153' +
+ '5c3a35e2',
+ sha384:
+ '6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82' +
+ '461e99c5a678cc31e799176d3860e6110c46523e',
+ sha512:
+ 'e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d' +
+ '20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de04460' +
+ '65c97440fa8c6a58'
}
}
];
@@ -165,12 +237,18 @@ var rfc2202_md5 = [
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: new Buffer('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
+ data: new Buffer('ddddddddddddddddddddddddddddddddddddddddddddddddd' +
+ 'ddddddddddddddddddddddddddddddddddddddddddddddddddd',
+ 'hex'),
hmac: '56be34521d144c88dbb8c733f0e8b3f6'
},
{
- key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
- data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
+ key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819',
+ 'hex'),
+ data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' +
+ 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' +
+ 'cdcdcdcdcd',
+ 'hex'),
hmac: '697eaf0aca3a3aea3a75164746ffaa79'
},
{
@@ -179,13 +257,23 @@ var rfc2202_md5 = [
hmac: '56461ef2342edc00f9bab995690efd4c'
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaa',
+ 'hex'),
data: 'Test Using Larger Than Block-Size Key - Hash Key First',
hmac: '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd'
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaa',
+ 'hex'),
+ data:
+ 'Test Using Larger Than Block-Size Key and Larger Than One ' +
+ 'Block-Size Data',
hmac: '6f630fad67cda0ee1fb1f562db3aa53e'
}
];
@@ -202,12 +290,19 @@ var rfc2202_sha1 = [
},
{
key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: new Buffer('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
+ data: new Buffer('ddddddddddddddddddddddddddddddddddddddddddddd' +
+ 'ddddddddddddddddddddddddddddddddddddddddddddd' +
+ 'dddddddddd',
+ 'hex'),
hmac: '125d7342b9ac11cd91a39af48aa17b4f63f175d3'
},
{
- key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
- data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
+ key: new Buffer('0102030405060708090a0b0c0d0e0f10111213141516171819',
+ 'hex'),
+ data: new Buffer('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' +
+ 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' +
+ 'cdcdcdcdcd',
+ 'hex'),
hmac: '4c9007f4026250c6bc8414f9bf50c86c2d7235da'
},
{
@@ -216,13 +311,23 @@ var rfc2202_sha1 = [
hmac: '4c1a03424b55e07fe7f27be1d58bb9324a9a5a04'
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaa',
+ 'hex'),
data: 'Test Using Larger Than Block-Size Key - Hash Key First',
hmac: 'aa4ae5e15272d00e95705637ce8a3b55ed402112'
},
{
- key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
- data: 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
+ key: new Buffer('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
+ 'aaaaaaaaaaaaaaaaaaaaaa',
+ 'hex'),
+ data:
+ 'Test Using Larger Than Block-Size Key and Larger Than One ' +
+ 'Block-Size Data',
hmac: 'e8e99d0f45237d786d6bbaa7965c7808bbff1a91'
}
];
@@ -402,7 +507,12 @@ assert.ok(rsaVerify);
rsaSign.update(rsaPubPem);
var rsaSignature = rsaSign.sign(rsaKeyPem, 'hex');
-assert.equal(rsaSignature, '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6');
+assert.equal(rsaSignature,
+ '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' +
+ '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' +
+ 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' +
+ '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' +
+ '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6');
rsaVerify.update(rsaPubPem);
assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
@@ -413,14 +523,19 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
//
(function() {
var privateKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_2.pem');
+ common.fixturesDir + '/test_rsa_privkey_2.pem');
var publicKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_pubkey_2.pem');
+ common.fixturesDir + '/test_rsa_pubkey_2.pem');
var input = 'I AM THE WALRUS';
- var signature = '79d59d34f56d0e94aa6a3e306882b52ed4191f07521f25f505a078dc2f89396e0c8ac89e996fde5717f4cb89199d8fec249961fcb07b74cd3d2a4ffa235417b69618e4bcd76b97e29975b7ce862299410e1b522a328e44ac9bb28195e0268da7eda23d9825ac43c724e86ceeee0d0d4465678652ccaf65010ddfb299bedeb1ad';
+ var signature =
+ '79d59d34f56d0e94aa6a3e306882b52ed4191f07521f25f505a078dc2f89' +
+ '396e0c8ac89e996fde5717f4cb89199d8fec249961fcb07b74cd3d2a4ffa' +
+ '235417b69618e4bcd76b97e29975b7ce862299410e1b522a328e44ac9bb2' +
+ '8195e0268da7eda23d9825ac43c724e86ceeee0d0d4465678652ccaf6501' +
+ '0ddfb299bedeb1ad';
var sign = crypto.createSign('RSA-SHA256');
sign.update(input);
@@ -440,10 +555,10 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
//
(function() {
var privateKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_privkey.pem');
+ common.fixturesDir + '/test_dsa_privkey.pem');
var publicKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_pubkey.pem');
+ common.fixturesDir + '/test_dsa_pubkey.pem');
var input = 'I AM THE WALRUS';
@@ -464,23 +579,42 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test PBKDF2 with RFC 6070 test vectors (except #4)
//
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');
+ 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) {
- 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');
+ 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) {
- 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');
+ 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) {
- 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(
+ '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) {
- assert.equal(result, '\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3', 'pbkdf1 test vector 6');
+ assert.equal(result,
+ '\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34' +
+ '\x25\xe0\xc3',
+ 'pbkdf1 test vector 6');
});
// Error path should not leak memory (check with valgrind).
diff --git a/test/simple/test-debugger-client.js b/test/simple/test-debugger-client.js
index 832e27fc31..5102a7b37d 100644
--- a/test/simple/test-debugger-client.js
+++ b/test/simple/test-debugger-client.js
@@ -56,14 +56,15 @@ parts.push('{"seq":12,"type":"event","event":"break","body":' +
assert.equal(78, parts[2].length);
bodyLength += parts[2].length;
-parts.push('.[anonymous](req=#<an IncomingMessage>, res=#<a ServerResponse>)",' +
- '"sourceLine"');
+parts.push('.[anonymous](req=#<an IncomingMessage>, ' +
+ 'res=#<a ServerResponse>)","sourceLine"');
assert.equal(78, parts[3].length);
bodyLength += parts[3].length;
-parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;","script":' +
- '{"id":24,"name":"/home/ryan/projects/node/benchmark/http_simple.js",' +
- '"lineOffset":0,"columnOffset":0,"lineCount":98}}}');
+parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;",' +
+ '"script":{"id":24,"name":"/home/ryan/projects/node/' +
+ 'benchmark/http_simple.js","lineOffset":0,"columnOffset":0,' +
+ '"lineCount":98}}}');
assert.equal(180, parts[4].length);
bodyLength += parts[4].length;
@@ -80,10 +81,12 @@ assert.equal(2, resCount);
var d = 'Content-Length: 466\r\n\r\n' +
'{"seq":10,"type":"event","event":"afterCompile","success":true,' +
'"body":{"script":{"handle":1,"type":"script","name":"dns.js",' +
- '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,"sourceStart":' +
- '"(function (module, exports, require) {var dns = process.binding(\'cares\')' +
+ '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,' +
+ '"sourceStart":"(function (module, exports, require) {' +
+ 'var dns = process.binding(\'cares\')' +
';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' +
- '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":[{"handle":0' +
+ '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":' +
+ '[{"handle":0' +
',"type":"context","text":"#<a ContextMirror>"}],"running":true}' +
'Content-Length: 119\r\n\r\n' +
'{"seq":11,"type":"event","event":"scriptCollected","success":true,' +
diff --git a/test/simple/test-debugger-repl.js b/test/simple/test-debugger-repl.js
index 44a89b94e3..663a9e60eb 100644
--- a/test/simple/test-debugger-repl.js
+++ b/test/simple/test-debugger-repl.js
@@ -112,7 +112,7 @@ addTest('watchers', [
]);
// Unwatch
-addTest('unwatch("\'x\'"), true', [ /true/ ]);
+addTest('unwatch("\'x\'"), true', [/true/]);
// Step out
addTest('o', [
diff --git a/test/simple/test-dgram-broadcast-multi-process.js b/test/simple/test-dgram-broadcast-multi-process.js
index 7ef4070581..7b3aa4d81e 100644
--- a/test/simple/test-dgram-broadcast-multi-process.js
+++ b/test/simple/test-dgram-broadcast-multi-process.js
@@ -37,16 +37,17 @@ var common = require('../common'),
if (process.argv[2] !== 'child') {
var workers = {},
- listeners = 3,
- listening = 0,
- dead = 0,
- i = 0,
- done = 0,
- timer = null;
+ listeners = 3,
+ listening = 0,
+ dead = 0,
+ i = 0,
+ done = 0,
+ timer = null;
//exit the test if it doesn't succeed within TIMEOUT
- timer = setTimeout(function () {
- console.error('[PARENT] Responses were not received within %d ms.', TIMEOUT);
+ timer = setTimeout(function() {
+ console.error('[PARENT] Responses were not received within %d ms.',
+ TIMEOUT);
console.error('[PARENT] Fail');
killChildren(workers);
@@ -56,22 +57,26 @@ if (process.argv[2] !== 'child') {
//launch child processes
for (var x = 0; x < listeners; x++) {
- (function () {
+ (function() {
var worker = fork(process.argv[1], ['child']);
workers[worker.pid] = worker;
worker.messagesReceived = [];
//handle the death of workers
- worker.on('exit', function (code, signal) {
- //don't consider this the true death if the worker has finished successfully
- //or if the exit code is 0
+ worker.on('exit', function(code, signal) {
+ // don't consider this the true death if the worker
+ // has finished successfully
+ // or if the exit code is 0
if (worker.isDone || code == 0) {
return;
}
-
+
dead += 1;
- console.error('[PARENT] Worker %d died. %d dead of %d', worker.pid, dead, listeners);
+ console.error('[PARENT] Worker %d died. %d dead of %d',
+ worker.pid,
+ dead,
+ listeners);
if (dead === listeners) {
console.error('[PARENT] All workers have died.');
@@ -83,7 +88,7 @@ if (process.argv[2] !== 'child') {
}
});
- worker.on('message', function (msg) {
+ worker.on('message', function(msg) {
if (msg.listening) {
listening += 1;
@@ -98,15 +103,17 @@ if (process.argv[2] !== 'child') {
if (worker.messagesReceived.length === messages.length) {
done += 1;
worker.isDone = true;
- console.error('[PARENT] %d received %d messages total.', worker.pid,
- worker.messagesReceived.length);
+ console.error('[PARENT] %d received %d messages total.',
+ worker.pid,
+ worker.messagesReceived.length);
}
if (done === listeners) {
- console.error('[PARENT] All workers have received the required number of '
- + 'messages. Will now compare.');
+ console.error('[PARENT] All workers have received the ' +
+ 'required number of ' +
+ 'messages. Will now compare.');
- Object.keys(workers).forEach(function (pid) {
+ Object.keys(workers).forEach(function(pid) {
var worker = workers[pid];
var count = 0;
@@ -120,11 +127,12 @@ if (process.argv[2] !== 'child') {
}
});
- console.error('[PARENT] %d received %d matching messges.', worker.pid
- , count);
+ console.error('[PARENT] %d received %d matching messges.',
+ worker.pid,
+ count);
- assert.equal(count, messages.length
- ,'A worker received an invalid multicast message');
+ assert.equal(count, messages.length,
+ 'A worker received an invalid multicast message');
});
clearTimeout(timer);
@@ -154,17 +162,18 @@ if (process.argv[2] !== 'child') {
}
sendSocket.send(buf, 0, buf.length,
- common.PORT, LOCAL_BROADCAST_HOST, function(err) {
+ common.PORT, LOCAL_BROADCAST_HOST, function(err) {
- if (err) throw err;
+ if (err) throw err;
- console.error('[PARENT] sent %s to %s:%s', util.inspect(buf.toString())
- , LOCAL_BROADCAST_HOST, common.PORT);
+ console.error('[PARENT] sent %s to %s:%s',
+ util.inspect(buf.toString()),
+ LOCAL_BROADCAST_HOST, common.PORT);
- process.nextTick(sendSocket.sendNext);
- });
+ process.nextTick(sendSocket.sendNext);
+ });
};
-
+
function killChildren(children) {
Object.keys(children).forEach(function(key) {
var child = children[key];
@@ -178,15 +187,17 @@ if (process.argv[2] === 'child') {
var listenSocket = dgram.createSocket('udp4');
listenSocket.on('message', function(buf, rinfo) {
- console.error('[CHILD] %s received %s from %j', process.pid
- , util.inspect(buf.toString()), rinfo);
+ console.error('[CHILD] %s received %s from %j',
+ process.pid,
+ util.inspect(buf.toString()),
+ rinfo);
receivedMessages.push(buf);
- process.send({ message : buf.toString() });
+ process.send({ message: buf.toString() });
if (receivedMessages.length == messages.length) {
- process.nextTick(function () {
+ process.nextTick(function() {
listenSocket.close();
});
}
@@ -202,7 +213,7 @@ if (process.argv[2] === 'child') {
});
listenSocket.on('listening', function() {
- process.send({ listening : true });
+ process.send({ listening: true });
});
listenSocket.bind(common.PORT);
diff --git a/test/simple/test-dgram-multicast-multi-process.js b/test/simple/test-dgram-multicast-multi-process.js
index d6f1c4793d..4f07820650 100644
--- a/test/simple/test-dgram-multicast-multi-process.js
+++ b/test/simple/test-dgram-multicast-multi-process.js
@@ -37,16 +37,17 @@ var common = require('../common'),
if (process.argv[2] !== 'child') {
var workers = {},
- listeners = 3,
- listening = 0,
- dead = 0,
- i = 0,
- done = 0,
- timer = null;
+ listeners = 3,
+ listening = 0,
+ dead = 0,
+ i = 0,
+ done = 0,
+ timer = null;
//exit the test if it doesn't succeed within TIMEOUT
- timer = setTimeout(function () {
- console.error('[PARENT] Responses were not received within %d ms.', TIMEOUT);
+ timer = setTimeout(function() {
+ console.error('[PARENT] Responses were not received within %d ms.',
+ TIMEOUT);
console.error('[PARENT] Fail');
killChildren(workers);
@@ -56,23 +57,27 @@ if (process.argv[2] !== 'child') {
//launch child processes
for (var x = 0; x < listeners; x++) {
- (function () {
+ (function() {
var worker = fork(process.argv[1], ['child']);
workers[worker.pid] = worker;
worker.messagesReceived = [];
//handle the death of workers
- worker.on('exit', function (code, signal) {
- //don't consider this the true death if the worker has finished successfully
+ worker.on('exit', function(code, signal) {
+ // don't consider this the true death if the
+ // worker has finished successfully
- //or if the exit code is 0
+ // or if the exit code is 0
if (worker.isDone || code === 0) {
return;
}
-
+
dead += 1;
- console.error('[PARENT] Worker %d died. %d dead of %d', worker.pid, dead, listeners);
+ console.error('[PARENT] Worker %d died. %d dead of %d',
+ worker.pid,
+ dead,
+ listeners);
if (dead === listeners) {
console.error('[PARENT] All workers have died.');
@@ -84,7 +89,7 @@ if (process.argv[2] !== 'child') {
}
});
- worker.on('message', function (msg) {
+ worker.on('message', function(msg) {
if (msg.listening) {
listening += 1;
@@ -99,15 +104,16 @@ if (process.argv[2] !== 'child') {
if (worker.messagesReceived.length === messages.length) {
done += 1;
worker.isDone = true;
- console.error('[PARENT] %d received %d messages total.', worker.pid,
- worker.messagesReceived.length);
+ console.error('[PARENT] %d received %d messages total.',
+ worker.pid,
+ worker.messagesReceived.length);
}
if (done === listeners) {
- console.error('[PARENT] All workers have received the required number of '
- + 'messages. Will now compare.');
+ console.error('[PARENT] All workers have received the ' +
+ 'required number of messages. Will now compare.');
- Object.keys(workers).forEach(function (pid) {
+ Object.keys(workers).forEach(function(pid) {
var worker = workers[pid];
var count = 0;
@@ -121,11 +127,11 @@ if (process.argv[2] !== 'child') {
}
});
- console.error('[PARENT] %d received %d matching messages.', worker.pid
- , count);
+ console.error('[PARENT] %d received %d matching messages.',
+ worker.pid, count);
- assert.equal(count, messages.length
- ,'A worker received an invalid multicast message');
+ assert.equal(count, messages.length,
+ 'A worker received an invalid multicast message');
});
clearTimeout(timer);
@@ -138,9 +144,10 @@ if (process.argv[2] !== 'child') {
}
var sendSocket = dgram.createSocket('udp4');
- sendSocket.bind(); // FIXME a libuv limitation makes it necessary to bind()
- // before calling any of the set*() functions - the bind()
- // call is what creates the actual socket...
+ // FIXME a libuv limitation makes it necessary to bind()
+ // before calling any of the set*() functions - the bind()
+ // call is what creates the actual socket...
+ sendSocket.bind();
sendSocket.setTTL(1);
sendSocket.setBroadcast(true);
@@ -160,12 +167,13 @@ if (process.argv[2] !== 'child') {
}
sendSocket.send(buf, 0, buf.length,
- common.PORT, LOCAL_BROADCAST_HOST, function(err) {
- if (err) throw err;
- console.error('[PARENT] sent %s to %s:%s', util.inspect(buf.toString()),
- LOCAL_BROADCAST_HOST, common.PORT);
- process.nextTick(sendSocket.sendNext);
- });
+ common.PORT, LOCAL_BROADCAST_HOST, function(err) {
+ if (err) throw err;
+ console.error('[PARENT] sent %s to %s:%s',
+ util.inspect(buf.toString()),
+ LOCAL_BROADCAST_HOST, common.PORT);
+ process.nextTick(sendSocket.sendNext);
+ });
};
function killChildren(children) {
@@ -181,12 +189,12 @@ if (process.argv[2] === 'child') {
var listenSocket = dgram.createSocket('udp4');
listenSocket.on('message', function(buf, rinfo) {
- console.error('[CHILD] %s received %s from %j', process.pid
- ,util.inspect(buf.toString()), rinfo);
+ console.error('[CHILD] %s received %s from %j', process.pid,
+ util.inspect(buf.toString()), rinfo);
receivedMessages.push(buf);
- process.send({ message : buf.toString() });
+ process.send({ message: buf.toString() });
if (receivedMessages.length == messages.length) {
listenSocket.dropMembership(LOCAL_BROADCAST_HOST);
@@ -202,13 +210,13 @@ if (process.argv[2] === 'child') {
//HACK: Wait to exit the process to ensure that the parent
//process has had time to receive all messages via process.send()
//This may be indicitave of some other issue.
- setTimeout(function () {
+ setTimeout(function() {
process.exit();
- }, 1000);
+ }, 1000);
});
listenSocket.on('listening', function() {
- process.send({ listening : true });
+ process.send({ listening: true });
});
listenSocket.bind(common.PORT);
diff --git a/test/simple/test-dgram-multicast-setTTL.js b/test/simple/test-dgram-multicast-setTTL.js
index cb870efdcf..8d1c0a06a2 100644
--- a/test/simple/test-dgram-multicast-setTTL.js
+++ b/test/simple/test-dgram-multicast-setTTL.js
@@ -30,9 +30,9 @@ socket.setMulticastTTL(16);
//Try to set an invalid TTL (valid ttl is > 0 and < 256)
try {
- socket.setMulticastTTL(1000);
+ socket.setMulticastTTL(1000);
} catch (e) {
- thrown = true;
+ thrown = true;
}
assert(thrown, 'Setting an invalid multicast TTL should throw some error');
diff --git a/test/simple/test-eio-limit.js b/test/simple/test-eio-limit.js
index 59cfbbfa65..78128647fe 100644
--- a/test/simple/test-eio-limit.js
+++ b/test/simple/test-eio-limit.js
@@ -26,7 +26,7 @@ var assert = require('assert'),
function repeat(fn) {
if (started != 0) {
- assert.ok(started - done < 100)
+ assert.ok(started - done < 100);
}
process.nextTick(function() {
diff --git a/test/simple/test-fs-append-file-sync.js b/test/simple/test-fs-append-file-sync.js
index c000946f95..5e1158fceb 100644
--- a/test/simple/test-fs-append-file-sync.js
+++ b/test/simple/test-fs-append-file-sync.js
@@ -54,7 +54,8 @@ fs.appendFileSync(filename2, data);
var fileData2 = fs.readFileSync(filename2);
-assert.equal(Buffer.byteLength(data) + currentFileData.length, fileData2.length);
+assert.equal(Buffer.byteLength(data) + currentFileData.length,
+ fileData2.length);
// test that appendFileSync accepts buffers
var filename3 = join(common.fixturesDir, 'append-sync3.txt');
@@ -78,7 +79,8 @@ fs.appendFileSync(filename4, num);
var fileData4 = fs.readFileSync(filename4);
-assert.equal(Buffer.byteLength('' + num) + currentFileData.length, fileData4.length);
+assert.equal(Buffer.byteLength('' + num) + currentFileData.length,
+ fileData4.length);
//exit logic for cleanup
diff --git a/test/simple/test-fs-append-file.js b/test/simple/test-fs-append-file.js
index 82a9d8f217..34be240029 100644
--- a/test/simple/test-fs-append-file.js
+++ b/test/simple/test-fs-append-file.js
@@ -82,10 +82,10 @@ var buf = new Buffer(s, 'utf8');
common.error('appending to ' + filename3);
fs.appendFile(filename3, buf, function(e) {
- if (e) throw e;
+ if (e) throw e;
- ncallbacks++;
- common.error('appended to file3');
+ ncallbacks++;
+ common.error('appended to file3');
fs.readFile(filename3, function(e, buffer) {
if (e) throw e;
@@ -111,7 +111,8 @@ fs.appendFile(filename4, n, function(e) {
if (e) throw e;
common.error('file4 read');
ncallbacks++;
- assert.equal(Buffer.byteLength('' + n) + currentFileData.length, buffer.length);
+ assert.equal(Buffer.byteLength('' + n) + currentFileData.length,
+ buffer.length);
});
});
diff --git a/test/simple/test-fs-exists.js b/test/simple/test-fs-exists.js
index cf785ccdb1..bdc81473c6 100644
--- a/test/simple/test-fs-exists.js
+++ b/test/simple/test-fs-exists.js
@@ -29,14 +29,14 @@ fs.exists(f, function(y) {
exists = y;
});
-fs.exists(f + '-NO', function (y) {
+fs.exists(f + '-NO', function(y) {
doesNotExist = y;
});
assert(fs.existsSync(f));
assert(!fs.existsSync(f + '-NO'));
-process.on('exit', function () {
+process.on('exit', function() {
assert.strictEqual(exists, true);
assert.strictEqual(doesNotExist, false);
});
diff --git a/test/simple/test-fs-open-flags.js b/test/simple/test-fs-open-flags.js
index 7d51cc9a4c..e1c6c3be99 100644
--- a/test/simple/test-fs-open-flags.js
+++ b/test/simple/test-fs-open-flags.js
@@ -25,34 +25,34 @@ var assert = require('assert');
var constants = require('constants');
var fs = require('fs');
-var O_APPEND = constants.O_APPEND || 0;
-var O_CREAT = constants.O_CREAT || 0;
+var O_APPEND = constants.O_APPEND || 0;
+var O_CREAT = constants.O_CREAT || 0;
var O_DIRECTORY = constants.O_DIRECTORY || 0;
-var O_EXCL = constants.O_EXCL || 0;
-var O_NOCTTY = constants.O_NOCTTY || 0;
-var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
-var O_RDONLY = constants.O_RDONLY || 0;
-var O_RDWR = constants.O_RDWR || 0;
-var O_SYMLINK = constants.O_SYMLINK || 0;
-var O_SYNC = constants.O_SYNC || 0;
-var O_TRUNC = constants.O_TRUNC || 0;
-var O_WRONLY = constants.O_WRONLY || 0;
+var O_EXCL = constants.O_EXCL || 0;
+var O_NOCTTY = constants.O_NOCTTY || 0;
+var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
+var O_RDONLY = constants.O_RDONLY || 0;
+var O_RDWR = constants.O_RDWR || 0;
+var O_SYMLINK = constants.O_SYMLINK || 0;
+var O_SYNC = constants.O_SYNC || 0;
+var O_TRUNC = constants.O_TRUNC || 0;
+var O_WRONLY = constants.O_WRONLY || 0;
-assert.equal(fs._stringToFlags('r'), O_RDONLY);
+assert.equal(fs._stringToFlags('r'), O_RDONLY);
assert.equal(fs._stringToFlags('r+'), O_RDWR);
-assert.equal(fs._stringToFlags('w'), O_TRUNC|O_CREAT|O_WRONLY);
-assert.equal(fs._stringToFlags('w+'), O_TRUNC|O_CREAT|O_RDWR);
-assert.equal(fs._stringToFlags('a'), O_APPEND|O_CREAT|O_WRONLY);
-assert.equal(fs._stringToFlags('a+'), O_APPEND|O_CREAT|O_RDWR);
+assert.equal(fs._stringToFlags('w'), O_TRUNC | O_CREAT | O_WRONLY);
+assert.equal(fs._stringToFlags('w+'), O_TRUNC | O_CREAT | O_RDWR);
+assert.equal(fs._stringToFlags('a'), O_APPEND | O_CREAT | O_WRONLY);
+assert.equal(fs._stringToFlags('a+'), O_APPEND | O_CREAT | O_RDWR);
-assert.equal(fs._stringToFlags('wx'), O_TRUNC|O_CREAT|O_WRONLY|O_EXCL);
-assert.equal(fs._stringToFlags('xw'), O_TRUNC|O_CREAT|O_WRONLY|O_EXCL);
-assert.equal(fs._stringToFlags('wx+'), O_TRUNC|O_CREAT|O_RDWR|O_EXCL);
-assert.equal(fs._stringToFlags('xw+'), O_TRUNC|O_CREAT|O_RDWR|O_EXCL);
-assert.equal(fs._stringToFlags('ax'), O_APPEND|O_CREAT|O_WRONLY|O_EXCL);
-assert.equal(fs._stringToFlags('xa'), O_APPEND|O_CREAT|O_WRONLY|O_EXCL);
-assert.equal(fs._stringToFlags('ax+'), O_APPEND|O_CREAT|O_RDWR|O_EXCL);
-assert.equal(fs._stringToFlags('xa+'), O_APPEND|O_CREAT|O_RDWR|O_EXCL);
+assert.equal(fs._stringToFlags('wx'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL);
+assert.equal(fs._stringToFlags('xw'), O_TRUNC | O_CREAT | O_WRONLY | O_EXCL);
+assert.equal(fs._stringToFlags('wx+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL);
+assert.equal(fs._stringToFlags('xw+'), O_TRUNC | O_CREAT | O_RDWR | O_EXCL);
+assert.equal(fs._stringToFlags('ax'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL);
+assert.equal(fs._stringToFlags('xa'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL);
+assert.equal(fs._stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
+assert.equal(fs._stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
('+ +a +r +w rw wa war raw r++ a++ w++' +
'x +x x+ rx rx+ wxx wax xwx xxx').split(' ').forEach(function(flags) {
diff --git a/test/simple/test-fs-watch.js b/test/simple/test-fs-watch.js
index 21fe3102e1..cfae57353f 100644
--- a/test/simple/test-fs-watch.js
+++ b/test/simple/test-fs-watch.js
@@ -51,10 +51,10 @@ process.on('exit', function() {
});
// Clean up stale files (if any) from previous run.
-try { fs.unlinkSync(filepathOne); } catch (e) { }
+try { fs.unlinkSync(filepathOne); } catch (e) { }
try { fs.unlinkSync(filepathTwoAbs); } catch (e) { }
-try { fs.unlinkSync(filepathThree); } catch (e) { }
-try { fs.rmdirSync(testsubdir); } catch (e) { }
+try { fs.unlinkSync(filepathThree); } catch (e) { }
+try { fs.rmdirSync(testsubdir); } catch (e) { }
fs.writeFileSync(filepathOne, 'hello');
diff --git a/test/simple/test-http-date-header.js b/test/simple/test-http-date-header.js
index e416b37583..8ed5281712 100644
--- a/test/simple/test-http-date-header.js
+++ b/test/simple/test-http-date-header.js
@@ -1,32 +1,51 @@
-var common = require("../common");
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// 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 assert = require('assert');
-var http = require("http");
+var http = require('http');
-var testResBody = "other stuff!\n";
+var testResBody = 'other stuff!\n';
var server = http.createServer(function(req, res) {
- assert.ok(! ("date" in req.headers),
- "Request headers contained a Date."
- );
+ assert.ok(! ('date' in req.headers),
+ 'Request headers contained a Date.');
res.writeHead(200, {
- 'Content-Type' : 'text/plain',
+ 'Content-Type': 'text/plain'
});
res.end(testResBody);
});
server.listen(common.PORT);
-server.addListener("listening", function() {
+server.addListener('listening', function() {
var options = {
port: common.PORT,
- path: "/",
- method: "GET"
- }
- var req = http.request(options, function (res) {
- assert.ok("date" in res.headers,
- "Response headers didn't contain a Date."
- );
- res.addListener('end', function () {
+ path: '/',
+ method: 'GET'
+ };
+ var req = http.request(options, function(res) {
+ assert.ok('date' in res.headers,
+ 'Response headers didn\'t contain a Date.');
+ res.addListener('end', function() {
server.close();
process.exit();
});
diff --git a/test/simple/test-http-max-headers-count.js b/test/simple/test-http-max-headers-count.js
index f34e7b5b79..97fce2c169 100644
--- a/test/simple/test-http-max-headers-count.js
+++ b/test/simple/test-http-max-headers-count.js
@@ -35,7 +35,7 @@ for (var i = 0; i < N; ++i) {
var maxAndExpected = [ // for server
[50, 50],
[1500, 1500],
- [0, N + 2], // Host and Connection
+ [0, N + 2] // Host and Connection
];
var max = maxAndExpected[requests][0];
var expected = maxAndExpected[requests][1];
@@ -56,7 +56,7 @@ server.listen(common.PORT, function() {
var maxAndExpected = [ // for client
[20, 20],
[1200, 1200],
- [0, N + 3], // Connection, Date and Transfer-Encoding
+ [0, N + 3] // Connection, Date and Transfer-Encoding
];
doRequest();
diff --git a/test/simple/test-http-parser-bad-ref.js b/test/simple/test-http-parser-bad-ref.js
index c8c6806fd6..43fad11b16 100644
--- a/test/simple/test-http-parser-bad-ref.js
+++ b/test/simple/test-http-parser-bad-ref.js
@@ -29,7 +29,7 @@ function demoBug(part1, part2) {
parser.onHeadersComplete = function(info) {
headersComplete++;
- console.log("url", info.url);
+ console.log('url', info.url);
};
parser.onBody = function(b, start, len) { };
@@ -45,7 +45,7 @@ function demoBug(part1, part2) {
var b = Buffer(part1);
flushPool();
- console.log("parse the first part of the message");
+ console.log('parse the first part of the message');
parser.execute(b, 0, b.length);
})();
@@ -54,7 +54,7 @@ function demoBug(part1, part2) {
(function() {
var b = Buffer(part2);
- console.log("parse the second part of the message");
+ console.log('parse the second part of the message');
parser.execute(b, 0, b.length);
parser.finish();
})();
@@ -76,5 +76,5 @@ demoBug('POST /1/22 HTTP/1.1\r\n' +
process.on('exit', function() {
assert.equal(2, headersComplete);
assert.equal(2, messagesComplete);
- console.log("done!");
+ console.log('done!');
});
diff --git a/test/simple/test-http-parser.js b/test/simple/test-http-parser.js
index e93b846c70..e8c8095131 100644
--- a/test/simple/test-http-parser.js
+++ b/test/simple/test-http-parser.js
@@ -24,7 +24,7 @@ var assert = require('assert');
var HTTPParser = process.binding('http_parser').HTTPParser;
-var CRLF = "\r\n";
+var CRLF = '\r\n';
var REQUEST = HTTPParser.REQUEST;
var RESPONSE = HTTPParser.RESPONSE;
@@ -87,9 +87,8 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'GET /hello HTTP/1.1' + CRLF +
- CRLF
- );
+ 'GET /hello HTTP/1.1' + CRLF +
+ CRLF);
var parser = newParser(REQUEST);
@@ -124,12 +123,11 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'HTTP/1.1 200 OK' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Content-Length: 4' + CRLF +
- CRLF +
- 'pong'
- );
+ 'HTTP/1.1 200 OK' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Content-Length: 4' + CRLF +
+ CRLF +
+ 'pong');
var parser = newParser(RESPONSE);
@@ -154,9 +152,8 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'HTTP/1.0 200 Connection established' + CRLF +
- CRLF
- );
+ 'HTTP/1.0 200 Connection established' + CRLF +
+ CRLF);
var parser = newParser(RESPONSE);
@@ -177,23 +174,22 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /it HTTP/1.1' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '4' + CRLF +
- 'ping' + CRLF +
- '0' + CRLF +
- 'Vary: *' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- CRLF
- );
+ 'POST /it HTTP/1.1' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '4' + CRLF +
+ 'ping' + CRLF +
+ '0' + CRLF +
+ 'Vary: *' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ CRLF);
var seen_body = false;
function onHeaders(headers, url) {
assert.ok(seen_body); // trailers should come after the body
assert.deepEqual(headers,
- ['Vary', '*', 'Content-Type', 'text/plain']);
+ ['Vary', '*', 'Content-Type', 'text/plain']);
}
var parser = newParser(REQUEST);
@@ -222,12 +218,11 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'GET / HTTP/1.0' + CRLF +
- 'X-Filler: 1337' + CRLF +
- 'X-Filler: 42' + CRLF +
- 'X-Filler2: 42' + CRLF +
- CRLF
- );
+ 'GET / HTTP/1.0' + CRLF +
+ 'X-Filler: 1337' + CRLF +
+ 'X-Filler: 42' + CRLF +
+ 'X-Filler2: 42' + CRLF +
+ CRLF);
var parser = newParser(REQUEST);
@@ -236,9 +231,9 @@ function expectBody(expected) {
assert.equal(info.versionMajor, 1);
assert.equal(info.versionMinor, 0);
assert.deepEqual(info.headers || parser.headers,
- ['X-Filler', '1337',
- 'X-Filler', '42',
- 'X-Filler2', '42']);
+ ['X-Filler', '1337',
+ 'X-Filler', '42',
+ 'X-Filler2', '42']);
});
parser.execute(request, 0, request.length);
@@ -254,10 +249,9 @@ function expectBody(expected) {
for (var i = 0; i < 8; ++i) lots_of_headers += lots_of_headers;
var request = Buffer(
- 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF +
- lots_of_headers +
- CRLF
- );
+ 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF +
+ lots_of_headers +
+ CRLF);
var parser = newParser(REQUEST);
@@ -285,12 +279,11 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /it HTTP/1.1' + CRLF +
- 'Content-Type: application/x-www-form-urlencoded' + CRLF +
- 'Content-Length: 15' + CRLF +
- CRLF +
- 'foo=42&bar=1337'
- );
+ 'POST /it HTTP/1.1' + CRLF +
+ 'Content-Type: application/x-www-form-urlencoded' + CRLF +
+ 'Content-Length: 15' + CRLF +
+ CRLF +
+ 'foo=42&bar=1337');
var parser = newParser(REQUEST);
@@ -315,18 +308,17 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /it HTTP/1.1' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '3' + CRLF +
- '123' + CRLF +
- '6' + CRLF +
- '123456' + CRLF +
- 'A' + CRLF +
- '1234567890' + CRLF +
- '0' + CRLF
- );
+ 'POST /it HTTP/1.1' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '3' + CRLF +
+ '123' + CRLF +
+ '6' + CRLF +
+ '123456' + CRLF +
+ 'A' + CRLF +
+ '1234567890' + CRLF +
+ '0' + CRLF);
var parser = newParser(REQUEST);
@@ -337,7 +329,8 @@ function expectBody(expected) {
assert.equal(info.versionMinor, 1);
});
- var body_part = 0, body_parts = ['123', '123456', '1234567890'];
+ var body_part = 0,
+ body_parts = ['123', '123456', '1234567890'];
function onBody(buf, start, len) {
var body = '' + buf.slice(start, start + len);
@@ -354,15 +347,14 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /it HTTP/1.1' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '3' + CRLF +
- '123' + CRLF +
- '6' + CRLF +
- '123456' + CRLF
- );
+ 'POST /it HTTP/1.1' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '3' + CRLF +
+ '123' + CRLF +
+ '6' + CRLF +
+ '123456' + CRLF);
var parser = newParser(REQUEST);
@@ -373,9 +365,10 @@ function expectBody(expected) {
assert.equal(info.versionMinor, 1);
});
- var body_part = 0, body_parts = [
- '123', '123456', '123456789',
- '123456789ABC', '123456789ABCDEF' ];
+ var body_part = 0,
+ body_parts = [
+ '123', '123456', '123456789',
+ '123456789ABC', '123456789ABCDEF'];
function onBody(buf, start, len) {
var body = '' + buf.slice(start, start + len);
@@ -386,14 +379,13 @@ function expectBody(expected) {
parser.execute(request, 0, request.length);
request = Buffer(
- '9' + CRLF +
- '123456789' + CRLF +
- 'C' + CRLF +
- '123456789ABC' + CRLF +
- 'F' + CRLF +
- '123456789ABCDEF' + CRLF +
- '0' + CRLF
- );
+ '9' + CRLF +
+ '123456789' + CRLF +
+ 'C' + CRLF +
+ '123456789ABC' + CRLF +
+ 'F' + CRLF +
+ '123456789ABCDEF' + CRLF +
+ '0' + CRLF);
parser.execute(request, 0, request.length);
})();
@@ -404,22 +396,21 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /helpme HTTP/1.1' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '3' + CRLF +
- '123' + CRLF +
- '6' + CRLF +
- '123456' + CRLF +
- '9' + CRLF +
- '123456789' + CRLF +
- 'C' + CRLF +
- '123456789ABC' + CRLF +
- 'F' + CRLF +
- '123456789ABCDEF' + CRLF +
- '0' + CRLF
- );
+ 'POST /helpme HTTP/1.1' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '3' + CRLF +
+ '123' + CRLF +
+ '6' + CRLF +
+ '123456' + CRLF +
+ '9' + CRLF +
+ '123456789' + CRLF +
+ 'C' + CRLF +
+ '123456789ABC' + CRLF +
+ 'F' + CRLF +
+ '123456789ABCDEF' + CRLF +
+ '0' + CRLF);
function test(a, b) {
var parser = newParser(REQUEST);
@@ -447,9 +438,11 @@ function expectBody(expected) {
for (var i = 1; i < request.length - 1; ++i) {
var a = request.slice(0, i);
- console.error("request.slice(0, " + i + ") = ", JSON.stringify(a.toString()));
+ console.error('request.slice(0, ' + i + ') = ',
+ JSON.stringify(a.toString()));
var b = request.slice(i);
- console.error("request.slice(" + i + ") = ", JSON.stringify(b.toString()));
+ console.error('request.slice(' + i + ') = ',
+ JSON.stringify(b.toString()));
test(a, b);
}
})();
@@ -460,22 +453,21 @@ function expectBody(expected) {
//
(function() {
var request = Buffer(
- 'POST /it HTTP/1.1' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '3' + CRLF +
- '123' + CRLF +
- '6' + CRLF +
- '123456' + CRLF +
- '9' + CRLF +
- '123456789' + CRLF +
- 'C' + CRLF +
- '123456789ABC' + CRLF +
- 'F' + CRLF +
- '123456789ABCDEF' + CRLF +
- '0' + CRLF
- );
+ 'POST /it HTTP/1.1' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '3' + CRLF +
+ '123' + CRLF +
+ '6' + CRLF +
+ '123456' + CRLF +
+ '9' + CRLF +
+ '123456789' + CRLF +
+ 'C' + CRLF +
+ '123456789ABC' + CRLF +
+ 'F' + CRLF +
+ '123456789ABCDEF' + CRLF +
+ '0' + CRLF);
var parser = newParser(REQUEST);
@@ -485,8 +477,8 @@ function expectBody(expected) {
assert.equal(info.versionMajor, 1);
assert.equal(info.versionMinor, 1);
assert.deepEqual(info.headers || parser.headers,
- ['Content-Type', 'text/plain',
- 'Transfer-Encoding','chunked']);
+ ['Content-Type', 'text/plain',
+ 'Transfer-Encoding', 'chunked']);
});
var expected_body = '123123456123456789123456789ABC123456789ABCDEF';
@@ -510,22 +502,20 @@ function expectBody(expected) {
//
(function() {
var req1 = Buffer(
- 'PUT /this HTTP/1.1' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Transfer-Encoding: chunked' + CRLF +
- CRLF +
- '4' + CRLF +
- 'ping' + CRLF +
- '0' + CRLF
- );
+ 'PUT /this HTTP/1.1' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Transfer-Encoding: chunked' + CRLF +
+ CRLF +
+ '4' + CRLF +
+ 'ping' + CRLF +
+ '0' + CRLF);
var req2 = Buffer(
- 'POST /that HTTP/1.0' + CRLF +
- 'Content-Type: text/plain' + CRLF +
- 'Content-Length: 4' + CRLF +
- CRLF +
- 'pong'
- );
+ 'POST /that HTTP/1.0' + CRLF +
+ 'Content-Type: text/plain' + CRLF +
+ 'Content-Length: 4' + CRLF +
+ CRLF +
+ 'pong');
function onHeadersComplete1(info) {
assert.equal(info.method, 'PUT');
@@ -533,8 +523,8 @@ function expectBody(expected) {
assert.equal(info.versionMajor, 1);
assert.equal(info.versionMinor, 1);
assert.deepEqual(info.headers,
- ['Content-Type', 'text/plain',
- 'Transfer-Encoding', 'chunked']);
+ ['Content-Type', 'text/plain',
+ 'Transfer-Encoding', 'chunked']);
};
function onHeadersComplete2(info) {
@@ -543,8 +533,8 @@ function expectBody(expected) {
assert.equal(info.versionMajor, 1);
assert.equal(info.versionMinor, 0);
assert.deepEqual(info.headers,
- ['Content-Type', 'text/plain',
- 'Content-Length', '4']);
+ ['Content-Type', 'text/plain',
+ 'Content-Length', '4']);
};
var parser = newParser(REQUEST);
diff --git a/test/simple/test-http-should-keep-alive.js b/test/simple/test-http-should-keep-alive.js
index 9e3dcf677e..fc1f5c6c26 100644
--- a/test/simple/test-http-should-keep-alive.js
+++ b/test/simple/test-http-should-keep-alive.js
@@ -30,7 +30,7 @@ var SERVER_RESPONSES = [
'HTTP/1.0 200 ok\r\nContent-Length: 0\r\nConnection: close\r\n\r\n',
'HTTP/1.1 200 ok\r\nContent-Length: 0\r\n\r\n',
'HTTP/1.1 200 ok\r\nContent-Length: 0\r\nConnection: keep-alive\r\n\r\n',
- 'HTTP/1.1 200 ok\r\nContent-Length: 0\r\nConnection: close\r\n\r\n',
+ 'HTTP/1.1 200 ok\r\nContent-Length: 0\r\nConnection: close\r\n\r\n'
];
var SHOULD_KEEP_ALIVE = [
false, // HTTP/1.0, default
@@ -38,7 +38,7 @@ var SHOULD_KEEP_ALIVE = [
false, // HTTP/1.0, Connection: close
true, // HTTP/1.1, default
true, // HTTP/1.1, Connection: keep-alive
- false, // HTTP/1.1, Connection: close
+ false // HTTP/1.1, Connection: close
];
var requests = 0;
var responses = 0;
diff --git a/test/simple/test-https-client-reject.js b/test/simple/test-https-client-reject.js
index 77820533da..700caee68a 100644
--- a/test/simple/test-https-client-reject.js
+++ b/test/simple/test-https-client-reject.js
@@ -77,7 +77,7 @@ function authorized() {
var options = {
port: common.PORT,
rejectUnauthorized: true,
- ca: [ fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) ]
+ ca: [fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))]
};
options.agent = new https.Agent(options);
var req = https.request(options, function(res) {
diff --git a/test/simple/test-net-connect-buffer.js b/test/simple/test-net-connect-buffer.js
index d0878ebb4c..0950593626 100644
--- a/test/simple/test-net-connect-buffer.js
+++ b/test/simple/test-net-connect-buffer.js
@@ -64,17 +64,17 @@ tcp.listen(common.PORT, function() {
assert.equal('opening', socket.readyState);
// Make sure that anything besides a buffer or a string throws.
- [ null,
- true,
- false,
- undefined,
- 1,
- 1.0,
- 1 / 0,
- +Infinity
- -Infinity,
- [],
- {}
+ [null,
+ true,
+ false,
+ undefined,
+ 1,
+ 1.0,
+ 1 / 0,
+ +Infinity,
+ -Infinity,
+ [],
+ {}
].forEach(function(v) {
function f() {
socket.write(v);
diff --git a/test/simple/test-net-dns-error.js b/test/simple/test-net-dns-error.js
index 76b5149756..67d1fc6846 100644
--- a/test/simple/test-net-dns-error.js
+++ b/test/simple/test-net-dns-error.js
@@ -38,7 +38,7 @@ function do_not_call() {
}
var socket = net.connect(42, host, do_not_call);
-socket.on('error', function (err) {
+socket.on('error', function(err) {
assert.equal(err.code, 'ENOTFOUND');
actual_bad_connections++;
});
diff --git a/test/simple/test-net-settimeout.js b/test/simple/test-net-settimeout.js
index 63d456bc06..5b14117e83 100644
--- a/test/simple/test-net-settimeout.js
+++ b/test/simple/test-net-settimeout.js
@@ -47,4 +47,4 @@ setTimeout(function() {
socket.destroy();
server.close();
assert.ok(true);
-}, T*2);
+}, T * 2);
diff --git a/test/simple/test-net-write-after-close.js b/test/simple/test-net-write-after-close.js
index 5b100b6626..fd0d30d540 100644
--- a/test/simple/test-net-write-after-close.js
+++ b/test/simple/test-net-write-after-close.js
@@ -31,12 +31,9 @@ process.on('exit', function() {
var server = net.createServer(function(socket) {
setTimeout(function() {
- assert.throws(
- function() {
- socket.write('test');
- },
- /This socket is closed/
- );
+ assert.throws(function() {
+ socket.write('test');
+ }, /This socket is closed/);
server.close();
gotError = true;
}, 250);
diff --git a/test/simple/test-querystring.js b/test/simple/test-querystring.js
index bfaf9ae18a..0764481cb8 100644
--- a/test/simple/test-querystring.js
+++ b/test/simple/test-querystring.js
@@ -185,9 +185,8 @@ assert.deepEqual({}, qs.parse());
// Test limiting
assert.equal(
- Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length,
- 1
-);
+ Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length,
+ 1);
// Test removing limit
function testUnlimitedKeys() {
@@ -199,9 +198,8 @@ function testUnlimitedKeys() {
url = qs.stringify(query);
assert.equal(
- Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
- 2000
- );
+ Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
+ 2000);
}
testUnlimitedKeys();
diff --git a/test/simple/test-regress-GH-877.js b/test/simple/test-regress-GH-877.js
index d9877f431f..d431118fdf 100644
--- a/test/simple/test-regress-GH-877.js
+++ b/test/simple/test-regress-GH-877.js
@@ -57,7 +57,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
agent.requests['127.0.0.1:' + common.PORT].length : 0));
var agentRequests = agent.requests[addrString] ?
- agent.requests[addrString].length : 0;
+ agent.requests[addrString].length : 0;
if (maxQueued < agentRequests) {
maxQueued = agentRequests;
diff --git a/test/simple/test-repl-tab-complete.js b/test/simple/test-repl-tab-complete.js
index 0bc43ab196..59483e2efd 100644
--- a/test/simple/test-repl-tab-complete.js
+++ b/test/simple/test-repl-tab-complete.js
@@ -187,5 +187,5 @@ putIn.run([
'var str = "test";'
]);
testMe.complete('str.len', function(error, data) {
- assert.deepEqual(data, [ [ 'str.length' ], 'str.len' ]);
+ assert.deepEqual(data, [['str.length'], 'str.len']);
});
diff --git a/test/simple/test-require-exceptions.js b/test/simple/test-require-exceptions.js
index 41f130acc8..307e3e2f33 100644
--- a/test/simple/test-require-exceptions.js
+++ b/test/simple/test-require-exceptions.js
@@ -34,9 +34,9 @@ assert.throws(function() {
// Requiring a module that does not exist should throw an
// error with its `code` set to MODULE_NOT_FOUND
-assert.throws(function () {
+assert.throws(function() {
require(common.fixturesDir + '/DOES_NOT_EXIST');
-}, function (e) {
+}, function(e) {
assert.equal('MODULE_NOT_FOUND', e.code);
return true;
});
diff --git a/test/simple/test-script-context.js b/test/simple/test-script-context.js
index a8d6c7a694..f29af2303f 100644
--- a/test/simple/test-script-context.js
+++ b/test/simple/test-script-context.js
@@ -65,7 +65,7 @@ function isTypeError(o) {
return o instanceof TypeError;
}
-[undefined, null, 0, 0.0, '', {}, []].forEach(function(e) {
+([undefined, null, 0, 0.0, '', {}, []].forEach(function(e) {
assert.throws(function() { script.runInContext(e); }, isTypeError);
assert.throws(function() { vm.runInContext('', e); }, isTypeError);
-});
+}));
diff --git a/test/simple/test-stdout-close-catch.js b/test/simple/test-stdout-close-catch.js
index a8373c4047..ab4342b616 100644
--- a/test/simple/test-stdout-close-catch.js
+++ b/test/simple/test-stdout-close-catch.js
@@ -39,7 +39,7 @@ var outputExpect = { 'code': 'EPIPE',
'errno': 'EPIPE',
'syscall': 'write' };
-child.stderr.on('data', function (c) {
+child.stderr.on('data', function(c) {
output += c;
});
diff --git a/test/simple/test-timers-zero-timeout.js b/test/simple/test-timers-zero-timeout.js
index d5e6df0786..9f77d7822d 100644
--- a/test/simple/test-timers-zero-timeout.js
+++ b/test/simple/test-timers-zero-timeout.js
@@ -27,7 +27,7 @@ var assert = require('assert');
var ncalled = 0;
setTimeout(f, 0, 'foo', 'bar', 'baz');
- var timer = setTimeout(function(){}, 0);
+ var timer = setTimeout(function() {}, 0);
function f(a, b, c) {
assert.equal(a, 'foo');
diff --git a/test/simple/test-tls-client-reject.js b/test/simple/test-tls-client-reject.js
index e11d790e60..5f5056e33e 100644
--- a/test/simple/test-tls-client-reject.js
+++ b/test/simple/test-tls-client-reject.js
@@ -75,7 +75,7 @@ function rejectUnauthorized() {
function authorized() {
var socket = tls.connect(common.PORT, {
rejectUnauthorized: true,
- ca: [ fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) ]
+ ca: [fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))]
}, function() {
assert(socket.authorized);
socket.end();
diff --git a/test/simple/test-tls-client-resume.js b/test/simple/test-tls-client-resume.js
index 5469c529fa..9fc84da3e1 100644
--- a/test/simple/test-tls-client-resume.js
+++ b/test/simple/test-tls-client-resume.js
@@ -59,7 +59,8 @@ server.listen(common.PORT, function() {
client1.on('close', function() {
console.log('close1');
- var client2 = tls.connect({'session': session1, port: common.PORT}, function() {
+ var opts = { 'session': session1, port: common.PORT };
+ var client2 = tls.connect(opts, function() {
console.log('connect2');
assert.ok(client2.isSessionReused(), 'Session *should* be reused.');
});
diff --git a/test/simple/test-tls-over-http-tunnel.js b/test/simple/test-tls-over-http-tunnel.js
index d2b8257e92..8c253419be 100644
--- a/test/simple/test-tls-over-http-tunnel.js
+++ b/test/simple/test-tls-over-http-tunnel.js
@@ -49,8 +49,8 @@ var options = {
var server = https.createServer(options, function(req, res) {
console.log('SERVER: got request');
res.writeHead(200, {
- 'content-type': 'text/plain',
- });
+ 'content-type': 'text/plain'
+ });
console.log('SERVER: sending response');
res.end('hello world\n');
});
@@ -63,8 +63,8 @@ var proxy = net.createServer(function(clientSocket) {
clientSocket.on('data', function(chunk) {
if (!serverSocket) {
// Verify the CONNECT request
- assert.equal('CONNECT localhost:' + common.PORT + ' HTTP/1.1\r\n' +
- 'Proxy-Connections: keep-alive\r\nContent-Length:' +
+ assert.equal('CONNECT localhost:' + common.PORT + ' HTTP/1.1\r\n' +
+ 'Proxy-Connections: keep-alive\r\nContent-Length:' +
' 0\r\nHost: localhost:' + proxyPort + '\r\n\r\n',
chunk);
@@ -133,7 +133,7 @@ proxy.listen(proxyPort, function() {
key: key,
cert: cert,
socket: res.socket, // reuse the socket
- agent: false,
+ agent: false
}, function(res) {
assert.equal(200, res.statusCode);
diff --git a/test/simple/test-typed-arrays.js b/test/simple/test-typed-arrays.js
index d3be0ddef2..6edcba1f81 100644
--- a/test/simple/test-typed-arrays.js
+++ b/test/simple/test-typed-arrays.js
@@ -89,7 +89,7 @@ function test(clazz) {
assert(0xF678, v4[0]);
// test set with typed array and []
- v2.set([ 1, 2, 3, 4 ], 2);
+ v2.set([1, 2, 3, 4], 2);
assert(0x1234, v1[0]);
var sub = new Int32Array(4);
diff --git a/test/simple/test-util-inspect.js b/test/simple/test-util-inspect.js
index f21123e82f..942e6e6de4 100644
--- a/test/simple/test-util-inspect.js
+++ b/test/simple/test-util-inspect.js
@@ -36,10 +36,10 @@ assert.equal(orig, after);
// test for sparse array
var a = ['foo', 'bar', 'baz'];
-assert.equal(util.inspect(a), "[ 'foo', 'bar', 'baz' ]");
+assert.equal(util.inspect(a), '[ \'foo\', \'bar\', \'baz\' ]');
delete a[1];
-assert.equal(util.inspect(a), "[ 'foo', , 'baz' ]");
-assert.equal(util.inspect(a, true), "[ 'foo', , 'baz', [length]: 3 ]");
+assert.equal(util.inspect(a), '[ \'foo\', , \'baz\' ]');
+assert.equal(util.inspect(a, true), '[ \'foo\', , \'baz\', [length]: 3 ]');
assert.equal(util.inspect(new Array(5)), '[ , , , , ]');
// test for property descriptors
@@ -51,7 +51,7 @@ var getter = Object.create(null, {
var setter = Object.create(null, {
b: {
set: function() {}
- },
+ }
});
var getterAndSetter = Object.create(null, {
c: {
@@ -59,11 +59,11 @@ var getterAndSetter = Object.create(null, {
set: function() {}
}
});
-assert.equal(util.inspect(getter, true), "{ [a]: [Getter] }");
-assert.equal(util.inspect(setter, true), "{ [b]: [Setter] }");
-assert.equal(util.inspect(getterAndSetter, true), "{ [c]: [Getter/Setter] }");
+assert.equal(util.inspect(getter, true), '{ [a]: [Getter] }');
+assert.equal(util.inspect(setter, true), '{ [b]: [Setter] }');
+assert.equal(util.inspect(getterAndSetter, true), '{ [c]: [Getter/Setter] }');
-// exceptions should print the error message, not "{}"
+// exceptions should print the error message, not '{}'
assert.equal(util.inspect(new Error()), '[Error]');
assert.equal(util.inspect(new Error('FAIL')), '[Error: FAIL]');
assert.equal(util.inspect(new TypeError('FAIL')), '[TypeError: FAIL]');
diff --git a/test/simple/test-zlib-invalid-input.js b/test/simple/test-zlib-invalid-input.js
index 4c581e1c33..305c4e0921 100644
--- a/test/simple/test-zlib-invalid-input.js
+++ b/test/simple/test-zlib-invalid-input.js
@@ -29,8 +29,8 @@ var nonStringInputs = [1, true, {a: 1}, ['a']];
nonStringInputs.forEach(function(input) {
// zlib.gunzip should not throw an error when called with bad input.
- assert.doesNotThrow(function () {
- zlib.gunzip(input, function (err, buffer) {
+ assert.doesNotThrow(function() {
+ zlib.gunzip(input, function(err, buffer) {
// zlib.gunzip should pass the error to the callback.
assert.ok(err);
});