mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
tools: add 'spaced-comment' into eslint rules
PR-URL: https://github.com/nodejs/node/pull/19596 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
parent
f89f79893d
commit
254058109f
@ -224,6 +224,10 @@ module.exports = {
|
||||
'space-in-parens': ['error', 'never'],
|
||||
'space-infix-ops': 'error',
|
||||
'space-unary-ops': 'error',
|
||||
'spaced-comment': ['error', 'always', {
|
||||
'block': { 'balanced': true },
|
||||
'exceptions': ['-']
|
||||
}],
|
||||
'strict': ['error', 'global'],
|
||||
'symbol-description': 'error',
|
||||
'template-curly-spacing': 'error',
|
||||
|
@ -4,7 +4,7 @@ const common = require('../common.js');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
aligned: ['true', 'false'],
|
||||
method: ['swap16', 'swap32', 'swap64'/*, 'htons', 'htonl', 'htonll'*/],
|
||||
method: ['swap16', 'swap32', 'swap64'/* , 'htons', 'htonl', 'htonll' */],
|
||||
len: [8, 64, 128, 256, 512, 768, 1024, 1536, 2056, 4096, 8192],
|
||||
n: [5e7]
|
||||
});
|
||||
|
@ -456,7 +456,7 @@ assert.equal(1, '1');
|
||||
assert.equal(1, 2);
|
||||
// AssertionError: 1 == 2
|
||||
assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
||||
//AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||
// AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||
```
|
||||
|
||||
If the values are not equal, an `AssertionError` is thrown with a `message`
|
||||
|
@ -166,11 +166,11 @@ directly by the shell and special characters (vary based on
|
||||
need to be dealt with accordingly:
|
||||
```js
|
||||
exec('"/path/to/test file/test.sh" arg1 arg2');
|
||||
//Double quotes are used so that the space in the path is not interpreted as
|
||||
//multiple arguments
|
||||
// Double quotes are used so that the space in the path is not interpreted as
|
||||
// multiple arguments
|
||||
|
||||
exec('echo "The \\$HOME variable is $HOME"');
|
||||
//The $HOME variable is escaped in the first instance, but not in the second
|
||||
// The $HOME variable is escaped in the first instance, but not in the second
|
||||
```
|
||||
|
||||
**Never pass unsanitized user input to this function. Any input containing shell
|
||||
|
@ -203,7 +203,7 @@ settings do not take effect until the `'localSettings'` event is emitted.
|
||||
session.settings({ enablePush: false });
|
||||
|
||||
session.on('localSettings', (settings) => {
|
||||
/** use the new settings **/
|
||||
/* Use the new settings */
|
||||
});
|
||||
```
|
||||
|
||||
@ -218,7 +218,7 @@ of the remote settings.
|
||||
|
||||
```js
|
||||
session.on('remoteSettings', (settings) => {
|
||||
/** use the new settings **/
|
||||
/* Use the new settings */
|
||||
});
|
||||
```
|
||||
|
||||
@ -280,7 +280,7 @@ activity on the `Http2Session` after the configured number of milliseconds.
|
||||
|
||||
```js
|
||||
session.setTimeout(2000);
|
||||
session.on('timeout', () => { /** .. **/ });
|
||||
session.on('timeout', () => { /* .. */ });
|
||||
```
|
||||
|
||||
#### http2session.alpnProtocol
|
||||
@ -706,8 +706,8 @@ const {
|
||||
const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
|
||||
req.on('response', (headers) => {
|
||||
console.log(headers[HTTP2_HEADER_STATUS]);
|
||||
req.on('data', (chunk) => { /** .. **/ });
|
||||
req.on('end', () => { /** .. **/ });
|
||||
req.on('data', (chunk) => { /* .. */ });
|
||||
req.on('end', () => { /* .. */ });
|
||||
});
|
||||
```
|
||||
|
||||
@ -1928,7 +1928,7 @@ Returns a `ClientHttp2Session` instance.
|
||||
const http2 = require('http2');
|
||||
const client = http2.connect('https://localhost:1234');
|
||||
|
||||
/** use the client **/
|
||||
/* Use the client */
|
||||
|
||||
client.close();
|
||||
```
|
||||
|
@ -914,7 +914,7 @@ in the [`net.createServer()`][] section:
|
||||
```js
|
||||
const net = require('net');
|
||||
const client = net.createConnection({ port: 8124 }, () => {
|
||||
//'connect' listener
|
||||
// 'connect' listener
|
||||
console.log('connected to server!');
|
||||
client.write('world!\r\n');
|
||||
});
|
||||
|
@ -134,8 +134,8 @@ Agent.prototype.getName = function getName(options) {
|
||||
return name;
|
||||
};
|
||||
|
||||
Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/,
|
||||
localAddress/*legacy*/) {
|
||||
Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
|
||||
localAddress/* legacy */) {
|
||||
// Legacy API: addRequest(req, host, port, localAddress)
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
|
@ -194,7 +194,7 @@ function ClientRequest(options, cb) {
|
||||
var posColon = hostHeader.indexOf(':');
|
||||
if (posColon !== -1 &&
|
||||
hostHeader.indexOf(':', posColon + 1) !== -1 &&
|
||||
hostHeader.charCodeAt(0) !== 91/*'['*/) {
|
||||
hostHeader.charCodeAt(0) !== 91/* '[' */) {
|
||||
hostHeader = `[${hostHeader}]`;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
|
||||
* Verifies that the given val is a valid HTTP token
|
||||
* per the rules defined in RFC 7230
|
||||
* See https://tools.ietf.org/html/rfc7230#section-3.2.6
|
||||
**/
|
||||
*/
|
||||
function checkIsHttpToken(val) {
|
||||
return tokenRegExp.test(val);
|
||||
}
|
||||
@ -248,7 +248,7 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
|
||||
* field-value = *( field-content / obs-fold )
|
||||
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
||||
* field-vchar = VCHAR / obs-text
|
||||
**/
|
||||
*/
|
||||
function checkInvalidHeaderChar(val) {
|
||||
return headerCharRegex.test(val);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ const doFlaggedDeprecation =
|
||||
* runtime deprecation would introduce too much breakage at this time. It's not
|
||||
* likely that the Buffer constructors would ever actually be removed.
|
||||
* Deprecation Code: DEP0005
|
||||
**/
|
||||
*/
|
||||
function Buffer(arg, encodingOrOffset, length) {
|
||||
doFlaggedDeprecation();
|
||||
// Common case.
|
||||
@ -196,7 +196,7 @@ Object.defineProperty(Buffer, Symbol.species, {
|
||||
* Buffer.from(array)
|
||||
* Buffer.from(buffer)
|
||||
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
||||
**/
|
||||
*/
|
||||
Buffer.from = function from(value, encodingOrOffset, length) {
|
||||
if (typeof value === 'string')
|
||||
return fromString(value, encodingOrOffset);
|
||||
@ -260,7 +260,7 @@ function assertSize(size) {
|
||||
/**
|
||||
* Creates a new filled Buffer instance.
|
||||
* alloc(size[, fill[, encoding]])
|
||||
**/
|
||||
*/
|
||||
Buffer.alloc = function alloc(size, fill, encoding) {
|
||||
assertSize(size);
|
||||
if (fill !== undefined && size > 0) {
|
||||
@ -272,7 +272,7 @@ Buffer.alloc = function alloc(size, fill, encoding) {
|
||||
/**
|
||||
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer
|
||||
* instance. If `--zero-fill-buffers` is set, will zero-fill the buffer.
|
||||
**/
|
||||
*/
|
||||
Buffer.allocUnsafe = function allocUnsafe(size) {
|
||||
assertSize(size);
|
||||
return allocate(size);
|
||||
@ -282,7 +282,7 @@ Buffer.allocUnsafe = function allocUnsafe(size) {
|
||||
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
|
||||
* Buffer instance that is not allocated off the pre-initialized pool.
|
||||
* If `--zero-fill-buffers` is set, will zero-fill the buffer.
|
||||
**/
|
||||
*/
|
||||
Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
||||
assertSize(size);
|
||||
return createUnsafeBuffer(size);
|
||||
|
@ -59,7 +59,7 @@ function stdioStringToArray(option) {
|
||||
}
|
||||
}
|
||||
|
||||
exports.fork = function(modulePath /*, args, options*/) {
|
||||
exports.fork = function(modulePath /* , args, options */) {
|
||||
|
||||
// Get options and args arguments.
|
||||
var execArgv;
|
||||
@ -143,7 +143,7 @@ function normalizeExecArgs(command, options, callback) {
|
||||
}
|
||||
|
||||
|
||||
exports.exec = function(command /*, options, callback*/) {
|
||||
exports.exec = function(command /* , options, callback */) {
|
||||
var opts = normalizeExecArgs.apply(null, arguments);
|
||||
return exports.execFile(opts.file,
|
||||
opts.options,
|
||||
@ -172,7 +172,7 @@ Object.defineProperty(exports.exec, util.promisify.custom, {
|
||||
value: customPromiseExecFunction(exports.exec)
|
||||
});
|
||||
|
||||
exports.execFile = function(file /*, args, options, callback*/) {
|
||||
exports.execFile = function(file /* , args, options, callback */) {
|
||||
var args = [];
|
||||
var callback;
|
||||
var options = {
|
||||
@ -511,7 +511,7 @@ function normalizeSpawnArguments(file, args, options) {
|
||||
}
|
||||
|
||||
|
||||
var spawn = exports.spawn = function(/*file, args, options*/) {
|
||||
var spawn = exports.spawn = function(/* file, args, options */) {
|
||||
var opts = normalizeSpawnArguments.apply(null, arguments);
|
||||
var options = opts.options;
|
||||
var child = new ChildProcess();
|
||||
@ -534,7 +534,7 @@ var spawn = exports.spawn = function(/*file, args, options*/) {
|
||||
return child;
|
||||
};
|
||||
|
||||
function spawnSync(/*file, args, options*/) {
|
||||
function spawnSync(/* file, args, options */) {
|
||||
var opts = normalizeSpawnArguments.apply(null, arguments);
|
||||
|
||||
var options = opts.options;
|
||||
@ -602,7 +602,7 @@ function checkExecSyncError(ret, args, cmd) {
|
||||
}
|
||||
|
||||
|
||||
function execFileSync(/*command, args, options*/) {
|
||||
function execFileSync(/* command, args, options */) {
|
||||
var opts = normalizeSpawnArguments.apply(null, arguments);
|
||||
var inheritStderr = !opts.options.stdio;
|
||||
|
||||
@ -621,7 +621,7 @@ function execFileSync(/*command, args, options*/) {
|
||||
exports.execFileSync = execFileSync;
|
||||
|
||||
|
||||
function execSync(command /*, options*/) {
|
||||
function execSync(command /* , options */) {
|
||||
var opts = normalizeExecArgs.apply(null, arguments);
|
||||
var inheritStderr = !opts.options.stdio;
|
||||
|
||||
|
@ -193,7 +193,7 @@ function bufferSize(self, size, buffer) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Socket.prototype.bind = function(port_, address_ /*, callback*/) {
|
||||
Socket.prototype.bind = function(port_, address_ /* , callback */) {
|
||||
let port = port_;
|
||||
|
||||
this._healthCheck();
|
||||
|
@ -160,7 +160,7 @@ fs.Stats = Stats;
|
||||
function isFileType(fileType) {
|
||||
// Use stats array directly to avoid creating an fs.Stats instance just for
|
||||
// our internal use.
|
||||
return (statValues[1/*mode*/] & S_IFMT) === fileType;
|
||||
return (statValues[1/* mode */] & S_IFMT) === fileType;
|
||||
}
|
||||
|
||||
// Don't allow mode to accidentally be overwritten.
|
||||
@ -1442,7 +1442,7 @@ function StatWatcher() {
|
||||
this._handle.onchange = function(newStatus) {
|
||||
if (oldStatus === -1 &&
|
||||
newStatus === -1 &&
|
||||
statValues[2/*new nlink*/] === statValues[16/*old nlink*/]) return;
|
||||
statValues[2/* new nlink */] === statValues[16/* old nlink */]) return;
|
||||
|
||||
oldStatus = newStatus;
|
||||
self.emit('change', statsFromValues(), statsFromPrevValues());
|
||||
|
@ -133,8 +133,8 @@ async function readFileHandle(filehandle, options) {
|
||||
const statFields = await binding.fstat(filehandle.fd, kUsePromises);
|
||||
|
||||
let size;
|
||||
if ((statFields[1/*mode*/] & S_IFMT) === S_IFREG) {
|
||||
size = statFields[8/*size*/];
|
||||
if ((statFields[1/* mode */] & S_IFMT) === S_IFREG) {
|
||||
size = statFields[8/* size */];
|
||||
} else {
|
||||
size = 0;
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ Module._extensions['.json'] = function(module, filename) {
|
||||
};
|
||||
|
||||
|
||||
//Native extension for .node
|
||||
// Native extension for .node
|
||||
Module._extensions['.node'] = function(module, filename) {
|
||||
return process.dlopen(module, path.toNamespacedPath(filename));
|
||||
};
|
||||
|
@ -712,7 +712,7 @@ function parseParams(qs) {
|
||||
const code = qs.charCodeAt(i);
|
||||
|
||||
// Try matching key/value pair separator
|
||||
if (code === 38/*&*/) {
|
||||
if (code === 38/* & */) {
|
||||
if (pairStart === i) {
|
||||
// We saw an empty substring between pair separators
|
||||
lastPos = pairStart = i + 1;
|
||||
@ -738,7 +738,7 @@ function parseParams(qs) {
|
||||
}
|
||||
|
||||
// Try matching key/value separator (e.g. '=') if we haven't already
|
||||
if (!seenSep && code === 61/*=*/) {
|
||||
if (!seenSep && code === 61/* = */) {
|
||||
// Key/value separator match!
|
||||
if (lastPos < i)
|
||||
buf += qs.slice(lastPos, i);
|
||||
@ -755,7 +755,7 @@ function parseParams(qs) {
|
||||
}
|
||||
|
||||
// Handle + and percent decoding.
|
||||
if (code === 43/*+*/) {
|
||||
if (code === 43/* + */) {
|
||||
if (lastPos < i)
|
||||
buf += qs.slice(lastPos, i);
|
||||
buf += ' ';
|
||||
@ -763,7 +763,7 @@ function parseParams(qs) {
|
||||
} else if (!encoded) {
|
||||
// Try to match an (valid) encoded byte (once) to minimize unnecessary
|
||||
// calls to string decoding functions
|
||||
if (code === 37/*%*/) {
|
||||
if (code === 37/* % */) {
|
||||
encodeCheck = 1;
|
||||
} else if (encodeCheck > 0) {
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
@ -799,7 +799,9 @@ function parseParams(qs) {
|
||||
// Adapted from querystring's implementation.
|
||||
// Ref: https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer
|
||||
const noEscape = [
|
||||
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
|
||||
/*
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
|
||||
*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 - 0x1F
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, // 0x20 - 0x2F
|
||||
|
@ -76,12 +76,12 @@ function unescapeBuffer(s, decodeSpaces) {
|
||||
var hasHex = false;
|
||||
while (index < s.length) {
|
||||
currentChar = s.charCodeAt(index);
|
||||
if (currentChar === 43 /*'+'*/ && decodeSpaces) {
|
||||
if (currentChar === 43 /* '+' */ && decodeSpaces) {
|
||||
out[outIndex++] = 32; // ' '
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (currentChar === 37 /*'%'*/ && index < maxLength) {
|
||||
if (currentChar === 37 /* '%' */ && index < maxLength) {
|
||||
currentChar = s.charCodeAt(++index);
|
||||
hexHigh = unhexTable[currentChar];
|
||||
if (!(hexHigh >= 0)) {
|
||||
@ -365,7 +365,7 @@ function parse(qs, sep, eq, options) {
|
||||
if (!keyEncoded) {
|
||||
// Try to match an (valid) encoded byte once to minimize unnecessary
|
||||
// calls to string decoding functions
|
||||
if (code === 37/*%*/) {
|
||||
if (code === 37/* % */) {
|
||||
encodeCheck = 1;
|
||||
continue;
|
||||
} else if (encodeCheck > 0) {
|
||||
@ -380,7 +380,7 @@ function parse(qs, sep, eq, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (code === 43/*+*/) {
|
||||
if (code === 43/* + */) {
|
||||
if (lastPos < i)
|
||||
key += qs.slice(lastPos, i);
|
||||
key += plusChar;
|
||||
@ -388,7 +388,7 @@ function parse(qs, sep, eq, options) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (code === 43/*+*/) {
|
||||
if (code === 43/* + */) {
|
||||
if (lastPos < i)
|
||||
value += qs.slice(lastPos, i);
|
||||
value += plusChar;
|
||||
@ -396,7 +396,7 @@ function parse(qs, sep, eq, options) {
|
||||
} else if (!valEncoded) {
|
||||
// Try to match an (valid) encoded byte (once) to minimize unnecessary
|
||||
// calls to string decoding functions
|
||||
if (code === 37/*%*/) {
|
||||
if (code === 37/* % */) {
|
||||
encodeCheck = 1;
|
||||
} else if (encodeCheck > 0) {
|
||||
// eslint-disable-next-line no-extra-boolean-cast
|
||||
|
56
lib/url.js
56
lib/url.js
@ -482,19 +482,19 @@ function validateHostname(self, rest, hostname) {
|
||||
// Escaped characters. Use empty strings to fill up unused entries.
|
||||
// Using Array is faster than Object/Map
|
||||
const escapedCodes = [
|
||||
/*0 - 9*/ '', '', '', '', '', '', '', '', '', '%09',
|
||||
/*10 - 19*/ '%0A', '', '', '%0D', '', '', '', '', '', '',
|
||||
/*20 - 29*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*30 - 39*/ '', '', '%20', '', '%22', '', '', '', '', '%27',
|
||||
/*40 - 49*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*50 - 59*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*60 - 69*/ '%3C', '', '%3E', '', '', '', '', '', '', '',
|
||||
/*70 - 79*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*80 - 89*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*90 - 99*/ '', '', '%5C', '', '%5E', '', '%60', '', '', '',
|
||||
/*100 - 109*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*110 - 119*/ '', '', '', '', '', '', '', '', '', '',
|
||||
/*120 - 125*/ '', '', '', '%7B', '%7C', '%7D'
|
||||
/* 0 - 9 */ '', '', '', '', '', '', '', '', '', '%09',
|
||||
/* 10 - 19 */ '%0A', '', '', '%0D', '', '', '', '', '', '',
|
||||
/* 20 - 29 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 30 - 39 */ '', '', '%20', '', '%22', '', '', '', '', '%27',
|
||||
/* 40 - 49 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 50 - 59 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 60 - 69 */ '%3C', '', '%3E', '', '', '', '', '', '', '',
|
||||
/* 70 - 79 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 80 - 89 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 90 - 99 */ '', '', '%5C', '', '%5E', '', '%60', '', '', '',
|
||||
/* 100 - 109 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 110 - 119 */ '', '', '', '', '', '', '', '', '', '',
|
||||
/* 120 - 125 */ '', '', '', '%7B', '%7C', '%7D'
|
||||
];
|
||||
|
||||
// Automatically escape all delimiters and unwise characters from RFC 2396.
|
||||
@ -592,7 +592,7 @@ Url.prototype.format = function format() {
|
||||
|
||||
var search = this.search || (query && ('?' + query)) || '';
|
||||
|
||||
if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/*:*/)
|
||||
if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/* : */)
|
||||
protocol += ':';
|
||||
|
||||
var newPathname = '';
|
||||
@ -628,10 +628,10 @@ Url.prototype.format = function format() {
|
||||
pathname = '/' + pathname;
|
||||
host = '//' + host;
|
||||
} else if (protocol.length >= 4 &&
|
||||
protocol.charCodeAt(0) === 102/*f*/ &&
|
||||
protocol.charCodeAt(1) === 105/*i*/ &&
|
||||
protocol.charCodeAt(2) === 108/*l*/ &&
|
||||
protocol.charCodeAt(3) === 101/*e*/) {
|
||||
protocol.charCodeAt(0) === 102/* f */ &&
|
||||
protocol.charCodeAt(1) === 105/* i */ &&
|
||||
protocol.charCodeAt(2) === 108/* l */ &&
|
||||
protocol.charCodeAt(3) === 101/* e */) {
|
||||
host = '//';
|
||||
}
|
||||
}
|
||||
@ -693,7 +693,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
result[rkey] = relative[rkey];
|
||||
}
|
||||
|
||||
//urlParse appends trailing / to urls like http://www.example.com
|
||||
// urlParse appends trailing / to urls like http://www.example.com
|
||||
if (slashedProtocol[result.protocol] &&
|
||||
result.hostname && !result.pathname) {
|
||||
result.path = result.pathname = '/';
|
||||
@ -819,9 +819,9 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
// Put this after the other two cases because it simplifies the booleans
|
||||
if (noLeadingSlashes) {
|
||||
result.hostname = result.host = srcPath.shift();
|
||||
//occasionally the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
// Occasionally the auth can get stuck only in host.
|
||||
// This especially happens in cases like
|
||||
// url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
const authInHost =
|
||||
result.host && result.host.indexOf('@') > 0 && result.host.split('@');
|
||||
if (authInHost) {
|
||||
@ -831,7 +831,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
}
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
//to support http.request
|
||||
// To support http.request
|
||||
if (result.pathname !== null || result.search !== null) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
@ -844,7 +844,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
// no path at all. easy.
|
||||
// we've already handled the other stuff above.
|
||||
result.pathname = null;
|
||||
//to support http.request
|
||||
// To support http.request
|
||||
if (result.search) {
|
||||
result.path = '/' + result.search;
|
||||
} else {
|
||||
@ -901,9 +901,9 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
if (noLeadingSlashes) {
|
||||
result.hostname =
|
||||
result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
|
||||
//occasionally the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
// Occasionally the auth can get stuck only in host.
|
||||
// This especially happens in cases like
|
||||
// url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
const authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||
result.host.split('@') : false;
|
||||
if (authInHost) {
|
||||
@ -925,7 +925,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
||||
result.pathname = srcPath.join('/');
|
||||
}
|
||||
|
||||
//to support request.http
|
||||
// To support request.http
|
||||
if (result.pathname !== null || result.search !== null) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
|
@ -284,7 +284,7 @@ function debuglog(set) {
|
||||
* @param {any} value The value to print out.
|
||||
* @param {Object} opts Optional options object that alters the output.
|
||||
*/
|
||||
/* Legacy: value, showHidden, depth, colors*/
|
||||
/* Legacy: value, showHidden, depth, colors */
|
||||
function inspect(value, opts) {
|
||||
// Default options
|
||||
const ctx = {
|
||||
|
@ -27,7 +27,7 @@ export function allowGlobals(...whitelist) {
|
||||
}
|
||||
|
||||
export function leakedGlobals() {
|
||||
//add possible expected globals
|
||||
// Add possible expected globals
|
||||
if (global.gc) {
|
||||
knownGlobals.push(global.gc);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ if (process.argv[2] !== 'child') {
|
||||
let done = 0;
|
||||
let timer = null;
|
||||
|
||||
//exit the test if it doesn't succeed within TIMEOUT
|
||||
// Exit the test if it doesn't succeed within TIMEOUT
|
||||
timer = setTimeout(function() {
|
||||
console.error('[PARENT] Responses were not received within %d ms.',
|
||||
TIMEOUT);
|
||||
@ -75,7 +75,7 @@ if (process.argv[2] !== 'child') {
|
||||
process.exit(1);
|
||||
}, TIMEOUT);
|
||||
|
||||
//launch child processes
|
||||
// Launch child processes
|
||||
for (let x = 0; x < listeners; x++) {
|
||||
(function() {
|
||||
const worker = fork(process.argv[1], ['child']);
|
||||
@ -83,7 +83,7 @@ if (process.argv[2] !== 'child') {
|
||||
|
||||
worker.messagesReceived = [];
|
||||
|
||||
//handle the death of workers
|
||||
// Handle the death of workers
|
||||
worker.on('exit', function(code, signal) {
|
||||
// don't consider this the true death if the worker
|
||||
// has finished successfully
|
||||
@ -113,7 +113,7 @@ if (process.argv[2] !== 'child') {
|
||||
listening += 1;
|
||||
|
||||
if (listening === listeners) {
|
||||
//all child process are listening, so start sending
|
||||
// All child process are listening, so start sending
|
||||
sendSocket.sendNext();
|
||||
}
|
||||
} else if (msg.message) {
|
||||
@ -239,9 +239,9 @@ if (process.argv[2] === 'child') {
|
||||
});
|
||||
|
||||
listenSocket.on('close', function() {
|
||||
//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 indicative of some other issue.
|
||||
// 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 indicative of some other issue.
|
||||
setTimeout(function() {
|
||||
process.exit();
|
||||
}, 1000);
|
||||
|
@ -646,7 +646,7 @@ assert.strictEqual('<Buffer 81 a3 66 6f 6f a3 62 61 72>', x.inspect());
|
||||
|
||||
{
|
||||
const buf = Buffer.allocUnsafe(2);
|
||||
assert.strictEqual(buf.write(''), 0); //0bytes
|
||||
assert.strictEqual(buf.write(''), 0); // 0bytes
|
||||
assert.strictEqual(buf.write('\0'), 1); // 1byte (v8 adds null terminator)
|
||||
assert.strictEqual(buf.write('a\0'), 2); // 1byte * 2
|
||||
assert.strictEqual(buf.write('あ'), 0); // 3bytes
|
||||
|
@ -132,7 +132,7 @@ assert.throws(function() {
|
||||
// If length can be converted to a number, it will be.
|
||||
assert.deepStrictEqual(Buffer.from(ab, 0, [1]), Buffer.from(ab, 0, 1));
|
||||
|
||||
//If length is Infinity, throw.
|
||||
// If length is Infinity, throw.
|
||||
common.expectsError(() => {
|
||||
Buffer.from(ab, 0, Infinity);
|
||||
}, {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*global SharedArrayBuffer*/
|
||||
/* global SharedArrayBuffer */
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
@ -23,16 +23,16 @@
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
//messages
|
||||
// Messages
|
||||
const PREFIX = 'NODE_';
|
||||
const normal = { cmd: `foo${PREFIX}` };
|
||||
const internal = { cmd: `${PREFIX}bar` };
|
||||
|
||||
if (process.argv[2] === 'child') {
|
||||
//send non-internal message containing PREFIX at a non prefix position
|
||||
// Send non-internal message containing PREFIX at a non prefix position
|
||||
process.send(normal);
|
||||
|
||||
//send internal message
|
||||
// Send internal message
|
||||
process.send(internal);
|
||||
|
||||
process.exit(0);
|
||||
|
@ -56,7 +56,7 @@ if (process.argv[2] === 'pipe') {
|
||||
const args = [process.argv[1], 'parent'];
|
||||
const parent = childProcess.spawn(process.execPath, args);
|
||||
|
||||
//got any stderr or std data
|
||||
// Got any stderr or std data
|
||||
let stdoutData = false;
|
||||
parent.stdout.on('data', function() {
|
||||
stdoutData = true;
|
||||
|
@ -79,7 +79,7 @@ if (!common.isWindows) {
|
||||
fail('uid', 3.1, invalidArgTypeError);
|
||||
fail('uid', -3.1, invalidArgTypeError);
|
||||
} else {
|
||||
//Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
// Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
invalidArgTypeErrorCount -= 10;
|
||||
}
|
||||
}
|
||||
@ -101,7 +101,7 @@ if (!common.isWindows) {
|
||||
fail('gid', 3.1, invalidArgTypeError);
|
||||
fail('gid', -3.1, invalidArgTypeError);
|
||||
} else {
|
||||
//Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
// Decrement invalidArgTypeErrorCount if validation isn't possible
|
||||
invalidArgTypeErrorCount -= 10;
|
||||
}
|
||||
}
|
||||
|
@ -78,45 +78,45 @@ if (cluster.isWorker) {
|
||||
|
||||
const stateNames = Object.keys(checks.worker.states);
|
||||
|
||||
//Check events, states, and emit arguments
|
||||
// Check events, states, and emit arguments
|
||||
forEach(checks.cluster.events, (bool, name, index) => {
|
||||
|
||||
//Listen on event
|
||||
// Listen on event
|
||||
cluster.on(name, common.mustCall(function(/* worker */) {
|
||||
|
||||
//Set event
|
||||
// Set event
|
||||
checks.cluster.events[name] = true;
|
||||
|
||||
//Check argument
|
||||
// Check argument
|
||||
checks.cluster.equal[name] = worker === arguments[0];
|
||||
|
||||
//Check state
|
||||
// Check state
|
||||
const state = stateNames[index];
|
||||
checks.worker.states[state] = (state === worker.state);
|
||||
}));
|
||||
});
|
||||
|
||||
//Kill worker when listening
|
||||
// Kill worker when listening
|
||||
cluster.on('listening', common.mustCall(() => {
|
||||
worker.kill();
|
||||
}));
|
||||
|
||||
//Kill process when worker is killed
|
||||
// Kill process when worker is killed
|
||||
cluster.on('exit', common.mustCall());
|
||||
|
||||
//Create worker
|
||||
// Create worker
|
||||
const worker = cluster.fork();
|
||||
assert.strictEqual(worker.id, 1);
|
||||
assert(worker instanceof cluster.Worker,
|
||||
'the worker is not a instance of the Worker constructor');
|
||||
|
||||
//Check event
|
||||
// Check event
|
||||
forEach(checks.worker.events, function(bool, name, index) {
|
||||
worker.on(name, common.mustCall(function() {
|
||||
//Set event
|
||||
// Set event
|
||||
checks.worker.events[name] = true;
|
||||
|
||||
//Check argument
|
||||
// Check argument
|
||||
checks.worker.equal[name] = (worker === this);
|
||||
|
||||
switch (name) {
|
||||
@ -146,33 +146,33 @@ if (cluster.isWorker) {
|
||||
}));
|
||||
});
|
||||
|
||||
//Check all values
|
||||
// Check all values
|
||||
process.once('exit', () => {
|
||||
//Check cluster events
|
||||
// Check cluster events
|
||||
forEach(checks.cluster.events, (check, name) => {
|
||||
assert(check,
|
||||
`The cluster event "${name}" on the cluster object did not fire`);
|
||||
});
|
||||
|
||||
//Check cluster event arguments
|
||||
// Check cluster event arguments
|
||||
forEach(checks.cluster.equal, (check, name) => {
|
||||
assert(check,
|
||||
`The cluster event "${name}" did not emit with correct argument`);
|
||||
});
|
||||
|
||||
//Check worker states
|
||||
// Check worker states
|
||||
forEach(checks.worker.states, (check, name) => {
|
||||
assert(check,
|
||||
`The worker state "${name}" was not set to true`);
|
||||
});
|
||||
|
||||
//Check worker events
|
||||
// Check worker events
|
||||
forEach(checks.worker.events, (check, name) => {
|
||||
assert(check,
|
||||
`The worker event "${name}" on the worker object did not fire`);
|
||||
});
|
||||
|
||||
//Check worker event arguments
|
||||
// Check worker event arguments
|
||||
forEach(checks.worker.equal, (check, name) => {
|
||||
assert(check,
|
||||
`The worker event "${name}" did not emit with correct argument`);
|
||||
|
@ -86,11 +86,11 @@ if (cluster.isWorker) {
|
||||
};
|
||||
|
||||
const test = (again) => {
|
||||
//1. start cluster
|
||||
// 1. start cluster
|
||||
startCluster(common.mustCall(() => {
|
||||
//2. test cluster
|
||||
// 2. test cluster
|
||||
testCluster(common.mustCall(() => {
|
||||
//3. disconnect cluster
|
||||
// 3. disconnect cluster
|
||||
cluster.disconnect(common.mustCall(() => {
|
||||
// run test again to confirm cleanup
|
||||
if (again) {
|
||||
|
@ -36,16 +36,16 @@ if (cluster.isWorker) {
|
||||
|
||||
} else if (cluster.isMaster) {
|
||||
|
||||
//Kill worker when listening
|
||||
// Kill worker when listening
|
||||
cluster.on('listening', function() {
|
||||
worker.kill();
|
||||
});
|
||||
|
||||
//Kill process when worker is killed
|
||||
// Kill process when worker is killed
|
||||
cluster.on('exit', function() {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
//Create worker
|
||||
// Create worker
|
||||
const worker = cluster.fork();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ testHelper(
|
||||
'require("crypto").getFips()',
|
||||
process.env);
|
||||
|
||||
//--force-fips should turn FIPS mode on
|
||||
// --force-fips should turn FIPS mode on
|
||||
testHelper(
|
||||
compiledWithFips() ? 'stdout' : 'stderr',
|
||||
['--force-fips'],
|
||||
@ -234,7 +234,7 @@ testHelper(
|
||||
'require("crypto").setFips(false)',
|
||||
process.env);
|
||||
|
||||
//--enable-fips and --force-fips order does not matter
|
||||
// --enable-fips and --force-fips order does not matter
|
||||
testHelper(
|
||||
'stderr',
|
||||
['--enable-fips', '--force-fips'],
|
||||
|
@ -260,7 +260,7 @@ assert.throws(function() {
|
||||
|
||||
/**
|
||||
* Check if the stream function uses utf8 as a default encoding.
|
||||
**/
|
||||
*/
|
||||
|
||||
function testEncoding(options, assertionHash) {
|
||||
const hash = crypto.createHash('sha256', options);
|
||||
|
@ -30,7 +30,7 @@ socket.on('listening', common.mustCall(() => {
|
||||
const result = socket.setMulticastTTL(16);
|
||||
assert.strictEqual(result, 16);
|
||||
|
||||
//Try to set an invalid TTL (valid ttl is > 0 and < 256)
|
||||
// Try to set an invalid TTL (valid ttl is > 0 and < 256)
|
||||
assert.throws(() => {
|
||||
socket.setMulticastTTL(1000);
|
||||
}, /^Error: setMulticastTTL EINVAL$/);
|
||||
@ -43,6 +43,6 @@ socket.on('listening', common.mustCall(() => {
|
||||
message: 'The "ttl" argument must be of type number. Received type string'
|
||||
});
|
||||
|
||||
//close the socket
|
||||
// Close the socket
|
||||
socket.close();
|
||||
}));
|
||||
|
@ -100,7 +100,7 @@ const fileData5 = fs.readFileSync(filename5);
|
||||
assert.strictEqual(Buffer.byteLength(data) + currentFileData.length,
|
||||
fileData5.length);
|
||||
|
||||
//exit logic for cleanup
|
||||
// Exit logic for cleanup
|
||||
|
||||
process.on('exit', function() {
|
||||
fs.unlinkSync(filename);
|
||||
|
@ -47,7 +47,6 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
request1.socket.on('close', common.mustCall());
|
||||
response.resume();
|
||||
response.on('end', common.mustCall(() => {
|
||||
/////////////////////////////////
|
||||
//
|
||||
// THE IMPORTANT PART
|
||||
//
|
||||
|
@ -27,10 +27,10 @@ server.listen(0, () => {
|
||||
res.on('end', common.mustCall(() => {
|
||||
process.nextTick(common.mustCall(() => {
|
||||
const freeSockets = agent.freeSockets[socketKey];
|
||||
//expect a free socket on socketKey
|
||||
// Expect a free socket on socketKey
|
||||
assert.strictEqual(freeSockets.length, 1);
|
||||
|
||||
//generate a random error on the free socket
|
||||
// Generate a random error on the free socket
|
||||
const freeSocket = freeSockets[0];
|
||||
freeSocket.emit('error', new Error('ECONNRESET: test'));
|
||||
|
||||
@ -40,7 +40,7 @@ server.listen(0, () => {
|
||||
}));
|
||||
|
||||
function done() {
|
||||
//expect the freeSockets pool to be empty
|
||||
// Expect the freeSockets pool to be empty
|
||||
assert.strictEqual(Object.keys(agent.freeSockets).length, 0);
|
||||
|
||||
agent.destroy();
|
||||
|
@ -48,8 +48,9 @@ function nextRequest() {
|
||||
if (countdown.dec()) {
|
||||
// throws error:
|
||||
nextRequest();
|
||||
// TODO: investigate why this does not work fine even though it should.
|
||||
// works just fine:
|
||||
//process.nextTick(nextRequest);
|
||||
// process.nextTick(nextRequest);
|
||||
}
|
||||
}));
|
||||
response.resume();
|
||||
|
@ -32,8 +32,6 @@ const options = {
|
||||
host: '127.0.0.1',
|
||||
};
|
||||
|
||||
//http.globalAgent.maxSockets = 15;
|
||||
|
||||
const server = http.createServer(function(req, res) {
|
||||
const m = /\/(.*)/.exec(req.url);
|
||||
const reqid = parseInt(m[1], 10);
|
||||
|
@ -66,7 +66,7 @@ const multipleForbidden = [
|
||||
'Max-Forwards',
|
||||
|
||||
// special case, tested differently
|
||||
//'Content-Length',
|
||||
// 'Content-Length',
|
||||
];
|
||||
|
||||
const srv = http.createServer(function(req, res) {
|
||||
|
@ -24,6 +24,7 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const net = require('net');
|
||||
const util = require('util');
|
||||
|
||||
let outstanding_reqs = 0;
|
||||
|
||||
@ -48,7 +49,6 @@ server.on('listening', function() {
|
||||
});
|
||||
|
||||
c.on('data', function(chunk) {
|
||||
//console.log(chunk);
|
||||
res_buffer += chunk;
|
||||
});
|
||||
|
||||
@ -78,7 +78,6 @@ server.on('listening', function() {
|
||||
});
|
||||
|
||||
c.on('data', function(chunk) {
|
||||
//console.log(chunk);
|
||||
res_buffer += chunk;
|
||||
if (/0\r\n/.test(res_buffer)) { // got the end.
|
||||
outstanding_reqs--;
|
||||
@ -103,8 +102,8 @@ server.on('listening', function() {
|
||||
headers: {}
|
||||
}, function(res) {
|
||||
res.on('end', function() {
|
||||
//console.log(res.trailers);
|
||||
assert.ok('x-foo' in res.trailers, 'Client doesn\'t see trailers.');
|
||||
assert.ok('x-foo' in res.trailers,
|
||||
`${util.inspect(res.trailers)} misses the 'x-foo' property`);
|
||||
outstanding_reqs--;
|
||||
if (outstanding_reqs === 0) {
|
||||
server.close();
|
||||
|
@ -28,11 +28,11 @@ const url = require('url');
|
||||
let testURL;
|
||||
|
||||
function check(request) {
|
||||
//url.parse should not mess with the method
|
||||
// url.parse should not mess with the method
|
||||
assert.strictEqual(request.method, 'POST');
|
||||
//everything else should be right
|
||||
// Everything else should be right
|
||||
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
|
||||
//the host header should use the url.parse.hostname
|
||||
// The host header should use the url.parse.hostname
|
||||
assert.strictEqual(request.headers.host,
|
||||
`${testURL.hostname}:${testURL.port}`);
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ function reqHandler(req, res) {
|
||||
`Wrong host header for req[${req.url}]: ${req.headers.host}`);
|
||||
}
|
||||
res.writeHead(200, {});
|
||||
//process.nextTick(function() { res.end('ok'); });
|
||||
res.end('ok');
|
||||
}
|
||||
|
||||
@ -55,7 +54,6 @@ function testHttps() {
|
||||
method: 'GET',
|
||||
path: `/${counter++}`,
|
||||
host: 'localhost',
|
||||
//agent: false,
|
||||
port: this.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, cb).on('error', thrower);
|
||||
@ -64,7 +62,6 @@ function testHttps() {
|
||||
method: 'GET',
|
||||
path: `/${counter++}`,
|
||||
host: 'localhost',
|
||||
//agent: false,
|
||||
port: this.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, cb).on('error', thrower).end();
|
||||
@ -73,7 +70,6 @@ function testHttps() {
|
||||
method: 'POST',
|
||||
path: `/${counter++}`,
|
||||
host: 'localhost',
|
||||
//agent: false,
|
||||
port: this.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, cb).on('error', thrower).end();
|
||||
@ -82,7 +78,6 @@ function testHttps() {
|
||||
method: 'PUT',
|
||||
path: `/${counter++}`,
|
||||
host: 'localhost',
|
||||
//agent: false,
|
||||
port: this.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, cb).on('error', thrower).end();
|
||||
@ -91,7 +86,6 @@ function testHttps() {
|
||||
method: 'DELETE',
|
||||
path: `/${counter++}`,
|
||||
host: 'localhost',
|
||||
//agent: false,
|
||||
port: this.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, cb).on('error', thrower).end();
|
||||
|
@ -100,7 +100,7 @@ assert.ok(type.length > 0);
|
||||
const release = os.release();
|
||||
is.string(release);
|
||||
assert.ok(release.length > 0);
|
||||
//TODO: Check format on more than just AIX
|
||||
// TODO: Check format on more than just AIX
|
||||
if (common.isAIX)
|
||||
assert.ok(/^\d+\.\d+$/.test(release));
|
||||
|
||||
|
@ -65,8 +65,6 @@ class TestReader extends R {
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
class TestWriter extends EE {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -33,8 +33,6 @@ function makeConnection() {
|
||||
};
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
let connectCount = 0;
|
||||
let endCount = 0;
|
||||
let shutdownCount = 0;
|
||||
|
@ -227,12 +227,7 @@ function runClient(prefix, port, options, cb) {
|
||||
}
|
||||
});
|
||||
|
||||
//client.stdout.pipe(process.stdout);
|
||||
|
||||
client.on('exit', function(code) {
|
||||
//assert.strictEqual(
|
||||
// 0, code,
|
||||
// `${prefix}${options.name}: s_client exited with error code ${code}`);
|
||||
if (options.shouldReject) {
|
||||
assert.strictEqual(
|
||||
true, rejected,
|
||||
|
@ -581,17 +581,17 @@ const parseTests = {
|
||||
href: 'git+http://github.com/joyent/node.git'
|
||||
},
|
||||
|
||||
//if local1@domain1 is uses as a relative URL it may
|
||||
//be parse into auth@hostname, but here there is no
|
||||
//way to make it work in url.parse, I add the test to be explicit
|
||||
// If local1@domain1 is uses as a relative URL it may
|
||||
// be parse into auth@hostname, but here there is no
|
||||
// way to make it work in url.parse, I add the test to be explicit
|
||||
'local1@domain1': {
|
||||
pathname: 'local1@domain1',
|
||||
path: 'local1@domain1',
|
||||
href: 'local1@domain1'
|
||||
},
|
||||
|
||||
//While this may seem counter-intuitive, a browser will parse
|
||||
//<a href='www.google.com'> as a path.
|
||||
// While this may seem counter-intuitive, a browser will parse
|
||||
// <a href='www.google.com'> as a path.
|
||||
'www.example.com': {
|
||||
href: 'www.example.com',
|
||||
pathname: 'www.example.com',
|
||||
|
@ -81,7 +81,7 @@ const bases = [
|
||||
'http:///s//a/b/c'
|
||||
];
|
||||
|
||||
//[to, from, result]
|
||||
// [to, from, result]
|
||||
const relativeTests2 = [
|
||||
// http://lists.w3.org/Archives/Public/uri/2004Feb/0114.html
|
||||
['../c', 'foo:a/b', 'foo:c'],
|
||||
@ -106,11 +106,11 @@ const relativeTests2 = [
|
||||
['/g', bases[0], 'http://a/g'],
|
||||
['//g', bases[0], 'http://g/'],
|
||||
// changed with RFC 2396bis
|
||||
//('?y', bases[0], 'http://a/b/c/d;p?y'],
|
||||
// ('?y', bases[0], 'http://a/b/c/d;p?y'],
|
||||
['?y', bases[0], 'http://a/b/c/d;p?y'],
|
||||
['g?y', bases[0], 'http://a/b/c/g?y'],
|
||||
// changed with RFC 2396bis
|
||||
//('#s', bases[0], CURRENT_DOC_URI + '#s'],
|
||||
// ('#s', bases[0], CURRENT_DOC_URI + '#s'],
|
||||
['#s', bases[0], 'http://a/b/c/d;p?q#s'],
|
||||
['g#s', bases[0], 'http://a/b/c/g#s'],
|
||||
['g?y#s', bases[0], 'http://a/b/c/g?y#s'],
|
||||
@ -118,7 +118,7 @@ const relativeTests2 = [
|
||||
['g;x', bases[0], 'http://a/b/c/g;x'],
|
||||
['g;x?y#s', bases[0], 'http://a/b/c/g;x?y#s'],
|
||||
// changed with RFC 2396bis
|
||||
//('', bases[0], CURRENT_DOC_URI],
|
||||
// ('', bases[0], CURRENT_DOC_URI],
|
||||
['', bases[0], 'http://a/b/c/d;p?q'],
|
||||
['.', bases[0], 'http://a/b/c/'],
|
||||
['./', bases[0], 'http://a/b/c/'],
|
||||
@ -131,10 +131,10 @@ const relativeTests2 = [
|
||||
['../../../g', bases[0], ('http://a/../g', 'http://a/g')],
|
||||
['../../../../g', bases[0], ('http://a/../../g', 'http://a/g')],
|
||||
// changed with RFC 2396bis
|
||||
//('/./g', bases[0], 'http://a/./g'],
|
||||
// ('/./g', bases[0], 'http://a/./g'],
|
||||
['/./g', bases[0], 'http://a/g'],
|
||||
// changed with RFC 2396bis
|
||||
//('/../g', bases[0], 'http://a/../g'],
|
||||
// ('/../g', bases[0], 'http://a/../g'],
|
||||
['/../g', bases[0], 'http://a/g'],
|
||||
['g.', bases[0], 'http://a/b/c/g.'],
|
||||
['.g', bases[0], 'http://a/b/c/.g'],
|
||||
@ -163,7 +163,7 @@ const relativeTests2 = [
|
||||
['/g', bases[1], 'http://a/g'],
|
||||
['//g', bases[1], 'http://g/'],
|
||||
// changed in RFC 2396bis
|
||||
//('?y', bases[1], 'http://a/b/c/?y'],
|
||||
// ('?y', bases[1], 'http://a/b/c/?y'],
|
||||
['?y', bases[1], 'http://a/b/c/d;p?y'],
|
||||
['g?y', bases[1], 'http://a/b/c/g?y'],
|
||||
['g?y/./x', bases[1], 'http://a/b/c/g?y/./x'],
|
||||
@ -345,7 +345,7 @@ const relativeTests2 = [
|
||||
'file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml'],
|
||||
['../b/c', 'foo:a/y/z', 'foo:a/b/c'],
|
||||
|
||||
//changeing auth
|
||||
// changeing auth
|
||||
['http://diff:auth@www.example.com',
|
||||
'http://asdf:qwer@www.example.com',
|
||||
'http://diff:auth@www.example.com/'],
|
||||
@ -383,10 +383,10 @@ relativeTests2.forEach(function(relativeTest) {
|
||||
` == ${e}\n actual=${a}`);
|
||||
});
|
||||
|
||||
//if format and parse are inverse operations then
|
||||
//resolveObject(parse(x), y) == parse(resolve(x, y))
|
||||
// If format and parse are inverse operations then
|
||||
// resolveObject(parse(x), y) == parse(resolve(x, y))
|
||||
|
||||
//format: [from, path, expected]
|
||||
// format: [from, path, expected]
|
||||
relativeTests.forEach(function(relativeTest) {
|
||||
let actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]);
|
||||
let expected = url.parse(relativeTest[2]);
|
||||
@ -402,7 +402,7 @@ relativeTests.forEach(function(relativeTest) {
|
||||
`actual: ${actual}`);
|
||||
});
|
||||
|
||||
//format: [to, from, result]
|
||||
// format: [to, from, result]
|
||||
// the test: ['.//g', 'f:/a', 'f://g'] is a fundamental problem
|
||||
// url.parse('f:/a') does not have a host
|
||||
// url.resolve('f:/a', './/g') does not have a host because you have moved
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*global SharedArrayBuffer*/
|
||||
/* global SharedArrayBuffer */
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const fixtures = require('../common/fixtures');
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*global SharedArrayBuffer*/
|
||||
/* global SharedArrayBuffer */
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
@ -44,7 +44,7 @@ const result = {
|
||||
result;
|
||||
`, ctx);
|
||||
|
||||
//eslint-disable-next-line no-restricted-properties
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
assert.deepEqual(result, {
|
||||
a: { value: 'a', writable: true, enumerable: true, configurable: true },
|
||||
b: { value: 'b', writable: false, enumerable: false, configurable: false },
|
||||
|
@ -54,7 +54,7 @@ const Script = require('vm').Script;
|
||||
script.runInNewContext();
|
||||
assert.strictEqual(5, global.hello);
|
||||
|
||||
// cleanup
|
||||
// Cleanup
|
||||
delete global.hello;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ const Script = require('vm').Script;
|
||||
assert.strictEqual(2, global.obj.bar);
|
||||
assert.strictEqual(2, global.foo);
|
||||
|
||||
//cleanup
|
||||
// cleanup
|
||||
delete global.code;
|
||||
delete global.foo;
|
||||
delete global.obj;
|
||||
|
@ -69,9 +69,6 @@ function test(next) {
|
||||
const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
|
||||
const child = spawn(common.opensslCli, args);
|
||||
|
||||
//child.stdout.pipe(process.stdout);
|
||||
//child.stderr.pipe(process.stderr);
|
||||
|
||||
child.stdout.resume();
|
||||
child.stderr.resume();
|
||||
|
||||
|
@ -32,7 +32,6 @@ function newBuffer(size, value) {
|
||||
while (size--) {
|
||||
buffer[size] = value;
|
||||
}
|
||||
//buffer[buffer.length-2]= 0x0d;
|
||||
buffer[buffer.length - 1] = 0x0a;
|
||||
return buffer;
|
||||
}
|
||||
@ -45,7 +44,7 @@ console.log(testFileName);
|
||||
|
||||
const kBufSize = 128 * 1024;
|
||||
let PASS = true;
|
||||
const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); //0x2e === '.'
|
||||
const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); // 0x2e === '.'
|
||||
const bufPool = [];
|
||||
|
||||
|
||||
@ -57,7 +56,7 @@ function tailCB(data) {
|
||||
}
|
||||
|
||||
|
||||
const timeToQuit = Date.now() + 8e3; //Test during no more than this seconds.
|
||||
const timeToQuit = Date.now() + 8e3; // Test during no more than this seconds.
|
||||
(function main() {
|
||||
|
||||
if (PASS) {
|
||||
|
@ -38,9 +38,7 @@ tailProc.stdout.on('data', tailCB);
|
||||
function tailCB(data) {
|
||||
PASS = !data.toString().includes('.');
|
||||
|
||||
if (PASS) {
|
||||
//console.error('i');
|
||||
} else {
|
||||
if (!PASS) {
|
||||
console.error('[FAIL]\n DATA -> ');
|
||||
console.error(data);
|
||||
console.error('\n');
|
||||
@ -52,9 +50,9 @@ function tailCB(data) {
|
||||
let PASS = true;
|
||||
const bufPool = [];
|
||||
const kBufSize = 16 * 1024 * 1024;
|
||||
const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); //0x2e === '.'
|
||||
const neverWrittenBuffer = newBuffer(kBufSize, 0x2e); // 0x2e === '.'
|
||||
|
||||
const timeToQuit = Date.now() + 5e3; //Test should last no more than this.
|
||||
const timeToQuit = Date.now() + 5e3; // Test should last no more than this.
|
||||
writer();
|
||||
|
||||
function writer() {
|
||||
@ -79,14 +77,12 @@ function writer() {
|
||||
bufPool.length = 0;
|
||||
}
|
||||
process.nextTick(writer);
|
||||
//console.error('o');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function writerCB(err, written) {
|
||||
//console.error('cb.');
|
||||
assert.ifError(err);
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,6 @@ function test(next) {
|
||||
const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
|
||||
const child = spawn(common.opensslCli, args);
|
||||
|
||||
//child.stdout.pipe(process.stdout);
|
||||
//child.stderr.pipe(process.stderr);
|
||||
|
||||
child.stdout.resume();
|
||||
child.stderr.resume();
|
||||
|
||||
|
@ -56,7 +56,6 @@ var timer = setTimeout(function() {
|
||||
|
||||
child.on('exit', function(code) {
|
||||
console.error('exit %d from gen %d', code, gen + 1);
|
||||
//clearTimeout(timer);
|
||||
});
|
||||
|
||||
child.stdout.pipe(process.stdout);
|
||||
|
@ -26,7 +26,7 @@ const assert = require('assert');
|
||||
if (process.argv[2] !== 'child') {
|
||||
const spawn = require('child_process').spawn;
|
||||
const child = spawn(process.execPath, [__filename, 'child'], {
|
||||
stdio: 'pipe'//'inherit'
|
||||
stdio: 'pipe'// 'inherit'
|
||||
});
|
||||
const timer = setTimeout(function() {
|
||||
throw new Error('child is hung');
|
||||
|
@ -102,7 +102,7 @@ assert(inited < 20000);
|
||||
assert.strictEqual(entry.entryType, 'measure');
|
||||
assert.strictEqual(entry.startTime, markA.startTime);
|
||||
// TODO(jasnell): This comparison is too imprecise on some systems
|
||||
//assert.strictEqual(entry.duration.toPrecision(3),
|
||||
// assert.strictEqual(entry.duration.toPrecision(3),
|
||||
// (markB.startTime - markA.startTime).toPrecision(3));
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user