test: fix style issues after eslint update
Replace var keyword with const or let. PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
parent
ec8e0ae697
commit
d1aabd6264
@ -437,7 +437,7 @@ exports.getServiceName = function getServiceName(port, protocol) {
|
|||||||
if (matches && matches.length > 1) {
|
if (matches && matches.length > 1) {
|
||||||
serviceName = matches[1];
|
serviceName = matches[1];
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.error('Cannot read file: ', etcServicesFileName);
|
console.error('Cannot read file: ', etcServicesFileName);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
|
|||||||
|
|
||||||
// continue - the breakpoint should be triggered
|
// continue - the breakpoint should be triggered
|
||||||
repl.addTest('c', [
|
repl.addTest('c', [
|
||||||
/break in .*[\\\/]mod\.js:23/,
|
/break in .*[\\\/]mod\.js:23/,
|
||||||
/21/, /22/, /23/, /24/, /25/
|
/21/, /22/, /23/, /24/, /25/
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// -- RESTORE BREAKPOINT ON RESTART --
|
// -- RESTORE BREAKPOINT ON RESTART --
|
||||||
|
@ -4,7 +4,7 @@ var repl = require('./helper-debugger-repl.js');
|
|||||||
|
|
||||||
repl.startDebugger('breakpoints.js');
|
repl.startDebugger('breakpoints.js');
|
||||||
var linesWithBreakpoint = [
|
var linesWithBreakpoint = [
|
||||||
/1/, /2/, /3/, /4/, /5/, /\* 6/
|
/1/, /2/, /3/, /4/, /5/, /\* 6/
|
||||||
];
|
];
|
||||||
// We slice here, because addTest will change the given array.
|
// We slice here, because addTest will change the given array.
|
||||||
repl.addTest('sb(6)', linesWithBreakpoint.slice());
|
repl.addTest('sb(6)', linesWithBreakpoint.slice());
|
||||||
|
@ -6,15 +6,15 @@ function serverHandler(req, res) {
|
|||||||
res.connection.destroy();
|
res.connection.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
weak = require('weak'),
|
const weak = require('weak');
|
||||||
done = 0,
|
const common = require('../common');
|
||||||
count = 0,
|
const assert = require('assert');
|
||||||
countGC = 0,
|
const PORT = common.PORT;
|
||||||
todo = 500,
|
const todo = 500;
|
||||||
common = require('../common'),
|
let done = 0;
|
||||||
assert = require('assert'),
|
let count = 0;
|
||||||
PORT = common.PORT;
|
let countGC = 0;
|
||||||
|
|
||||||
console.log('We should do ' + todo + ' requests');
|
console.log('We should do ' + todo + ' requests');
|
||||||
|
|
||||||
|
@ -8,15 +8,15 @@ function serverHandler(req, res) {
|
|||||||
res.end('Hello World\n');
|
res.end('Hello World\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
weak = require('weak'),
|
const weak = require('weak');
|
||||||
done = 0,
|
const common = require('../common');
|
||||||
count = 0,
|
const assert = require('assert');
|
||||||
countGC = 0,
|
const PORT = common.PORT;
|
||||||
todo = 500,
|
const todo = 500;
|
||||||
common = require('../common'),
|
let done = 0;
|
||||||
assert = require('assert'),
|
let count = 0;
|
||||||
PORT = common.PORT;
|
let countGC = 0;
|
||||||
|
|
||||||
console.log('We should do ' + todo + ' requests');
|
console.log('We should do ' + todo + ' requests');
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ function serverHandler(req, res) {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
weak = require('weak'),
|
const weak = require('weak');
|
||||||
done = 0,
|
const common = require('../common');
|
||||||
count = 0,
|
const assert = require('assert');
|
||||||
countGC = 0,
|
const PORT = common.PORT;
|
||||||
todo = 550,
|
const todo = 550;
|
||||||
common = require('../common'),
|
let done = 0;
|
||||||
assert = require('assert'),
|
let count = 0;
|
||||||
PORT = common.PORT;
|
let countGC = 0;
|
||||||
|
|
||||||
console.log('We should do ' + todo + ' requests');
|
console.log('We should do ' + todo + ' requests');
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@ function serverHandler(req, res) {
|
|||||||
res.end('Hello World\n');
|
res.end('Hello World\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
weak = require('weak'),
|
const weak = require('weak');
|
||||||
done = 0,
|
const common = require('../common');
|
||||||
count = 0,
|
const assert = require('assert');
|
||||||
countGC = 0,
|
const PORT = common.PORT;
|
||||||
todo = 500,
|
const todo = 500;
|
||||||
common = require('../common'),
|
let done = 0;
|
||||||
assert = require('assert'),
|
let count = 0;
|
||||||
PORT = common.PORT;
|
let countGC = 0;
|
||||||
|
|
||||||
console.log('We should do ' + todo + ' requests');
|
console.log('We should do ' + todo + ' requests');
|
||||||
|
|
||||||
|
@ -17,15 +17,15 @@ function serverHandler(sock) {
|
|||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
var net = require('net'),
|
const net = require('net');
|
||||||
weak = require('weak'),
|
const weak = require('weak');
|
||||||
done = 0,
|
const common = require('../common');
|
||||||
count = 0,
|
const assert = require('assert');
|
||||||
countGC = 0,
|
const PORT = common.PORT;
|
||||||
todo = 500,
|
const todo = 500;
|
||||||
common = require('../common'),
|
let done = 0;
|
||||||
assert = require('assert'),
|
let count = 0;
|
||||||
PORT = common.PORT;
|
let countGC = 0;
|
||||||
|
|
||||||
console.log('We should do ' + todo + ' requests');
|
console.log('We should do ' + todo + ' requests');
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
dgram = require('dgram'),
|
const dgram = require('dgram');
|
||||||
util = require('util'),
|
const util = require('util');
|
||||||
networkInterfaces = require('os').networkInterfaces(),
|
const networkInterfaces = require('os').networkInterfaces();
|
||||||
Buffer = require('buffer').Buffer,
|
const Buffer = require('buffer').Buffer;
|
||||||
fork = require('child_process').fork,
|
const fork = require('child_process').fork;
|
||||||
LOCAL_BROADCAST_HOST = '255.255.255.255',
|
const LOCAL_BROADCAST_HOST = '255.255.255.255';
|
||||||
TIMEOUT = common.platformTimeout(5000),
|
const TIMEOUT = common.platformTimeout(5000);
|
||||||
messages = [
|
const messages = [
|
||||||
new Buffer('First message to send'),
|
new Buffer('First message to send'),
|
||||||
new Buffer('Second message to send'),
|
new Buffer('Second message to send'),
|
||||||
new Buffer('Third message to send'),
|
new Buffer('Third message to send'),
|
||||||
new Buffer('Fourth message to send')
|
new Buffer('Fourth message to send')
|
||||||
];
|
];
|
||||||
|
|
||||||
if (common.inFreeBSDJail) {
|
if (common.inFreeBSDJail) {
|
||||||
console.log('1..0 # Skipped: in a FreeBSD jail');
|
console.log('1..0 # Skipped: in a FreeBSD jail');
|
||||||
@ -34,13 +34,13 @@ get_bindAddress: for (var name in networkInterfaces) {
|
|||||||
assert.ok(bindAddress);
|
assert.ok(bindAddress);
|
||||||
|
|
||||||
if (process.argv[2] !== 'child') {
|
if (process.argv[2] !== 'child') {
|
||||||
var workers = {},
|
const workers = {};
|
||||||
listeners = 3,
|
const listeners = 3;
|
||||||
listening = 0,
|
let listening = 0;
|
||||||
dead = 0,
|
let dead = 0;
|
||||||
i = 0,
|
let i = 0;
|
||||||
done = 0,
|
let done = 0;
|
||||||
timer = null;
|
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() {
|
timer = setTimeout(function() {
|
||||||
@ -166,15 +166,21 @@ if (process.argv[2] !== 'child') {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSocket.send(buf, 0, buf.length,
|
sendSocket.send(
|
||||||
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
|
buf,
|
||||||
if (err) throw err;
|
0,
|
||||||
console.error('[PARENT] sent %s to %s:%s',
|
buf.length,
|
||||||
util.inspect(buf.toString()),
|
common.PORT,
|
||||||
LOCAL_BROADCAST_HOST, 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);
|
process.nextTick(sendSocket.sendNext);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function killChildren(children) {
|
function killChildren(children) {
|
||||||
|
@ -157,14 +157,20 @@ if (process.argv[2] !== 'child') {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSocket.send(buf, 0, buf.length,
|
sendSocket.send(
|
||||||
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
|
buf,
|
||||||
if (err) throw err;
|
0,
|
||||||
console.error('[PARENT] sent "%s" to %s:%s',
|
buf.length,
|
||||||
buf.toString(),
|
common.PORT,
|
||||||
LOCAL_BROADCAST_HOST, common.PORT);
|
LOCAL_BROADCAST_HOST,
|
||||||
process.nextTick(sendSocket.sendNext);
|
function(err) {
|
||||||
});
|
if (err) throw err;
|
||||||
|
console.error('[PARENT] sent "%s" to %s:%s',
|
||||||
|
buf.toString(),
|
||||||
|
LOCAL_BROADCAST_HOST, common.PORT);
|
||||||
|
process.nextTick(sendSocket.sendNext);
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
dns = require('dns'),
|
const dns = require('dns');
|
||||||
net = require('net'),
|
const net = require('net');
|
||||||
isIPv4 = net.isIPv4;
|
const isIPv4 = net.isIPv4;
|
||||||
|
|
||||||
var expected = 0,
|
let expected = 0;
|
||||||
completed = 0,
|
let completed = 0;
|
||||||
running = false,
|
let running = false;
|
||||||
queue = [];
|
const queue = [];
|
||||||
|
|
||||||
function TEST(f) {
|
function TEST(f) {
|
||||||
function next() {
|
function next() {
|
||||||
@ -148,19 +148,22 @@ TEST(function test_lookup_localhost_ipv4(done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST(function test_lookup_all_ipv4(done) {
|
TEST(function test_lookup_all_ipv4(done) {
|
||||||
var req = dns.lookup('www.google.com', {all: true, family: 4},
|
var req = dns.lookup(
|
||||||
function(err, ips) {
|
'www.google.com',
|
||||||
if (err) throw err;
|
{all: true, family: 4},
|
||||||
assert.ok(Array.isArray(ips));
|
function(err, ips) {
|
||||||
assert.ok(ips.length > 0);
|
if (err) throw err;
|
||||||
|
assert.ok(Array.isArray(ips));
|
||||||
|
assert.ok(ips.length > 0);
|
||||||
|
|
||||||
ips.forEach(function(ip) {
|
ips.forEach(function(ip) {
|
||||||
assert.ok(isIPv4(ip.address));
|
assert.ok(isIPv4(ip.address));
|
||||||
assert.strictEqual(ip.family, 4);
|
assert.strictEqual(ip.family, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
checkWrap(req);
|
checkWrap(req);
|
||||||
});
|
});
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
dns = require('dns'),
|
const dns = require('dns');
|
||||||
net = require('net'),
|
const net = require('net');
|
||||||
isIPv6 = net.isIPv6;
|
const isIPv6 = net.isIPv6;
|
||||||
|
|
||||||
var expected = 0,
|
let expected = 0;
|
||||||
completed = 0,
|
let completed = 0;
|
||||||
running = false,
|
let running = false;
|
||||||
queue = [];
|
const queue = [];
|
||||||
|
|
||||||
if (!common.hasIPv6) {
|
if (!common.hasIPv6) {
|
||||||
console.log('1..0 # Skipped: this test, no IPv6 support');
|
console.log('1..0 # Skipped: this test, no IPv6 support');
|
||||||
@ -156,20 +156,23 @@ TEST(function test_lookup_ip_ipv6(done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TEST(function test_lookup_all_ipv6(done) {
|
TEST(function test_lookup_all_ipv6(done) {
|
||||||
var req = dns.lookup('www.google.com', {all: true, family: 6},
|
var req = dns.lookup(
|
||||||
function(err, ips) {
|
'www.google.com',
|
||||||
if (err) throw err;
|
{all: true, family: 6},
|
||||||
assert.ok(Array.isArray(ips));
|
function(err, ips) {
|
||||||
assert.ok(ips.length > 0);
|
if (err) throw err;
|
||||||
|
assert.ok(Array.isArray(ips));
|
||||||
|
assert.ok(ips.length > 0);
|
||||||
|
|
||||||
ips.forEach(function(ip) {
|
ips.forEach(function(ip) {
|
||||||
assert.ok(isIPv6(ip.address),
|
assert.ok(isIPv6(ip.address),
|
||||||
'Invalid IPv6: ' + ip.address.toString());
|
'Invalid IPv6: ' + ip.address.toString());
|
||||||
assert.strictEqual(ip.family, 6);
|
assert.strictEqual(ip.family, 6);
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
checkWrap(req);
|
checkWrap(req);
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
dns = require('dns'),
|
const dns = require('dns');
|
||||||
net = require('net'),
|
const net = require('net');
|
||||||
isIPv4 = net.isIPv4,
|
const isIPv4 = net.isIPv4;
|
||||||
isIPv6 = net.isIPv6;
|
const isIPv6 = net.isIPv6;
|
||||||
var util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
var expected = 0,
|
let expected = 0;
|
||||||
completed = 0,
|
let completed = 0;
|
||||||
running = false,
|
let running = false;
|
||||||
queue = [];
|
const queue = [];
|
||||||
|
|
||||||
|
|
||||||
function TEST(f) {
|
function TEST(f) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
exception = null;
|
let exception = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eval('"\\uc/ef"');
|
eval('"\\uc/ef"');
|
||||||
|
@ -921,8 +921,8 @@ Buffer(Buffer(0), 0, 0);
|
|||||||
|
|
||||||
// GH-5110
|
// GH-5110
|
||||||
(function() {
|
(function() {
|
||||||
var buffer = new Buffer('test'),
|
const buffer = new Buffer('test');
|
||||||
string = JSON.stringify(buffer);
|
const string = JSON.stringify(buffer);
|
||||||
|
|
||||||
assert.equal(string, '{"type":"Buffer","data":[116,101,115,116]}');
|
assert.equal(string, '{"type":"Buffer","data":[116,101,115,116]}');
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
os = require('os'),
|
const os = require('os');
|
||||||
util = require('util'),
|
const util = require('util');
|
||||||
spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
|
|
||||||
// We're trying to reproduce:
|
// We're trying to reproduce:
|
||||||
// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/
|
// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/
|
||||||
|
@ -6,18 +6,18 @@ var fork = require('child_process').fork;
|
|||||||
|
|
||||||
// Fork, then spawn. The spawned process should not hang.
|
// Fork, then spawn. The spawned process should not hang.
|
||||||
switch (process.argv[2] || '') {
|
switch (process.argv[2] || '') {
|
||||||
case '':
|
case '':
|
||||||
fork(__filename, ['fork']).on('exit', checkExit);
|
fork(__filename, ['fork']).on('exit', checkExit);
|
||||||
process.on('exit', haveExit);
|
process.on('exit', haveExit);
|
||||||
break;
|
break;
|
||||||
case 'fork':
|
case 'fork':
|
||||||
spawn(process.execPath, [__filename, 'spawn']).on('exit', checkExit);
|
spawn(process.execPath, [__filename, 'spawn']).on('exit', checkExit);
|
||||||
process.on('exit', haveExit);
|
process.on('exit', haveExit);
|
||||||
break;
|
break;
|
||||||
case 'spawn':
|
case 'spawn':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var seenExit = false;
|
var seenExit = false;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
common = require('../common'),
|
const common = require('../common');
|
||||||
fork = require('child_process').fork;
|
const fork = require('child_process').fork;
|
||||||
|
|
||||||
var cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
|
var cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
|
||||||
|
|
||||||
var gotMessage = false,
|
let gotMessage = false;
|
||||||
gotExit = false,
|
let gotExit = false;
|
||||||
gotClose = false;
|
let gotClose = false;
|
||||||
|
|
||||||
cp.on('message', function(message) {
|
cp.on('message', function(message) {
|
||||||
assert(!gotMessage);
|
assert(!gotMessage);
|
||||||
|
@ -69,7 +69,13 @@ if (process.argv[2] === 'child') {
|
|||||||
|
|
||||||
var sendMessages = function() {
|
var sendMessages = function() {
|
||||||
var timer = setInterval(function() {
|
var timer = setInterval(function() {
|
||||||
client.send(msg, 0, msg.length, common.PORT, '127.0.0.1', function(err) {
|
client.send(
|
||||||
|
msg,
|
||||||
|
0,
|
||||||
|
msg.length,
|
||||||
|
common.PORT,
|
||||||
|
'127.0.0.1',
|
||||||
|
function(err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -66,8 +66,8 @@ if (process.argv[2] === 'child') {
|
|||||||
|
|
||||||
var server = net.createServer();
|
var server = net.createServer();
|
||||||
|
|
||||||
var connected = 0,
|
let connected = 0;
|
||||||
closed = 0;
|
let closed = 0;
|
||||||
server.on('connection', function(socket) {
|
server.on('connection', function(socket) {
|
||||||
switch (connected % 6) {
|
switch (connected % 6) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -5,11 +5,11 @@ if (module.parent) {
|
|||||||
process.exit(42);
|
process.exit(42);
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
child = require('child_process'),
|
const child = require('child_process');
|
||||||
path = require('path'),
|
const path = require('path');
|
||||||
nodejs = '"' + process.execPath + '"';
|
const nodejs = '"' + process.execPath + '"';
|
||||||
|
|
||||||
|
|
||||||
// replace \ by / because windows uses backslashes in paths, but they're still
|
// replace \ by / because windows uses backslashes in paths, but they're still
|
||||||
|
@ -24,23 +24,23 @@ if (cluster.isWorker) {
|
|||||||
} else if (cluster.isMaster) {
|
} else if (cluster.isMaster) {
|
||||||
|
|
||||||
var expected_results = {
|
var expected_results = {
|
||||||
cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"],
|
cluster_emitDisconnect: [1, "the cluster did not emit 'disconnect'"],
|
||||||
cluster_emitExit: [1, "the cluster did not emit 'exit'"],
|
cluster_emitExit: [1, "the cluster did not emit 'exit'"],
|
||||||
cluster_exitCode: [EXIT_CODE, 'the cluster exited w/ incorrect exitCode'],
|
cluster_exitCode: [EXIT_CODE, 'the cluster exited w/ incorrect exitCode'],
|
||||||
cluster_signalCode: [null, 'the cluster exited w/ incorrect signalCode'],
|
cluster_signalCode: [null, 'the cluster exited w/ incorrect signalCode'],
|
||||||
worker_emitDisconnect: [1, "the worker did not emit 'disconnect'"],
|
worker_emitDisconnect: [1, "the worker did not emit 'disconnect'"],
|
||||||
worker_emitExit: [1, "the worker did not emit 'exit'"],
|
worker_emitExit: [1, "the worker did not emit 'exit'"],
|
||||||
worker_state: ['disconnected', 'the worker state is incorrect'],
|
worker_state: ['disconnected', 'the worker state is incorrect'],
|
||||||
worker_suicideMode: [false, 'the worker.suicide flag is incorrect'],
|
worker_suicideMode: [false, 'the worker.suicide flag is incorrect'],
|
||||||
worker_died: [true, 'the worker is still running'],
|
worker_died: [true, 'the worker is still running'],
|
||||||
worker_exitCode: [EXIT_CODE, 'the worker exited w/ incorrect exitCode'],
|
worker_exitCode: [EXIT_CODE, 'the worker exited w/ incorrect exitCode'],
|
||||||
worker_signalCode: [null, 'the worker exited w/ incorrect signalCode']
|
worker_signalCode: [null, 'the worker exited w/ incorrect signalCode']
|
||||||
};
|
};
|
||||||
var results = {
|
var results = {
|
||||||
cluster_emitDisconnect: 0,
|
cluster_emitDisconnect: 0,
|
||||||
cluster_emitExit: 0,
|
cluster_emitExit: 0,
|
||||||
worker_emitDisconnect: 0,
|
worker_emitDisconnect: 0,
|
||||||
worker_emitExit: 0
|
worker_emitExit: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -103,8 +103,8 @@ if (cluster.isWorker) {
|
|||||||
|
|
||||||
function checkResults(expected_results, results) {
|
function checkResults(expected_results, results) {
|
||||||
for (var k in expected_results) {
|
for (var k in expected_results) {
|
||||||
var actual = results[k],
|
const actual = results[k];
|
||||||
expected = expected_results[k];
|
const expected = expected_results[k];
|
||||||
|
|
||||||
var msg = (expected[1] || '') +
|
var msg = (expected[1] || '') +
|
||||||
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
||||||
|
@ -103,8 +103,8 @@ if (cluster.isWorker) {
|
|||||||
|
|
||||||
function checkResults(expected_results, results) {
|
function checkResults(expected_results, results) {
|
||||||
for (var k in expected_results) {
|
for (var k in expected_results) {
|
||||||
var actual = results[k],
|
const actual = results[k];
|
||||||
expected = expected_results[k];
|
const expected = expected_results[k];
|
||||||
|
|
||||||
var msg = (expected[1] || '') +
|
var msg = (expected[1] || '') +
|
||||||
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
(' [expected: ' + expected[0] + ' / actual: ' + actual + ']');
|
||||||
|
@ -15,11 +15,11 @@ crypto.DEFAULT_ENCODING = 'buffer';
|
|||||||
* Input data
|
* Input data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ODD_LENGTH_PLAIN = 'Hello node world!',
|
const ODD_LENGTH_PLAIN = 'Hello node world!';
|
||||||
EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi';
|
const EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi';
|
||||||
|
|
||||||
var KEY_PLAIN = 'S3c.r.e.t.K.e.Y!',
|
const KEY_PLAIN = 'S3c.r.e.t.K.e.Y!';
|
||||||
IV_PLAIN = 'blahFizz2011Buzz';
|
const IV_PLAIN = 'blahFizz2011Buzz';
|
||||||
|
|
||||||
var CIPHER_NAME = 'aes-128-cbc';
|
var CIPHER_NAME = 'aes-128-cbc';
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ if (!common.hasFipsCrypto) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decipher._flush() should emit an error event, not an exception.
|
// Decipher._flush() should emit an error event, not an exception.
|
||||||
var key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex'),
|
const key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex');
|
||||||
badkey = new Buffer('12341234123412341234123412341234', 'hex'),
|
const badkey = new Buffer('12341234123412341234123412341234', 'hex');
|
||||||
iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex'),
|
const iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex');
|
||||||
cipher = crypto.createCipheriv('aes-128-cbc', key, iv),
|
const cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
|
||||||
decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
|
const decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
|
||||||
|
|
||||||
cipher.pipe(decipher)
|
cipher.pipe(decipher)
|
||||||
.on('error', common.mustCall(function end(err) {
|
.on('error', common.mustCall(function end(err) {
|
||||||
|
@ -5,8 +5,14 @@ var dgram = require('dgram');
|
|||||||
|
|
||||||
var message = new Buffer('Some bytes');
|
var message = new Buffer('Some bytes');
|
||||||
var client = dgram.createSocket('udp4');
|
var client = dgram.createSocket('udp4');
|
||||||
client.send(message, 0, message.length, 41234, 'localhost',
|
client.send(
|
||||||
function(err, bytes) {
|
message,
|
||||||
assert.strictEqual(bytes, message.length);
|
0,
|
||||||
client.close();
|
message.length,
|
||||||
});
|
41234,
|
||||||
|
'localhost',
|
||||||
|
function(err, bytes) {
|
||||||
|
assert.strictEqual(bytes, message.length);
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Ensure that if a dgram socket is closed before the DNS lookup completes, it
|
// Ensure that if a dgram socket is closed before the DNS lookup completes, it
|
||||||
// won't crash.
|
// won't crash.
|
||||||
|
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
common = require('../common'),
|
const common = require('../common');
|
||||||
dgram = require('dgram');
|
const dgram = require('dgram');
|
||||||
|
|
||||||
var buf = new Buffer(1024);
|
var buf = new Buffer(1024);
|
||||||
buf.fill(42);
|
buf.fill(42);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
dgram = require('dgram'),
|
const dgram = require('dgram');
|
||||||
thrown = false,
|
const socket = dgram.createSocket('udp4');
|
||||||
socket = dgram.createSocket('udp4');
|
let thrown = false;
|
||||||
|
|
||||||
socket.bind(common.PORT);
|
socket.bind(common.PORT);
|
||||||
socket.on('listening', function() {
|
socket.on('listening', function() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const dgram = require('dgram');
|
||||||
var dgram = require('dgram'), server, client,
|
const server_port = common.PORT;
|
||||||
server_port = common.PORT,
|
const message_to_send = 'A message to send';
|
||||||
message_to_send = 'A message to send',
|
let server, client;
|
||||||
timer;
|
let timer;
|
||||||
|
|
||||||
server = dgram.createSocket('udp4');
|
server = dgram.createSocket('udp4');
|
||||||
server.on('message', function(msg, rinfo) {
|
server.on('message', function(msg, rinfo) {
|
||||||
@ -28,13 +28,19 @@ server.on('listening', function() {
|
|||||||
client.close();
|
client.close();
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
client.send(message_to_send, 0, message_to_send.length,
|
client.send(
|
||||||
server_port, 'localhost', function(err) {
|
message_to_send,
|
||||||
if (err) {
|
0,
|
||||||
console.log('Caught error in client send.');
|
message_to_send.length,
|
||||||
throw err;
|
server_port,
|
||||||
}
|
'localhost',
|
||||||
});
|
function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log('Caught error in client send.');
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
client.on('close',
|
client.on('close',
|
||||||
function() {
|
function() {
|
||||||
if (server.fd === null) {
|
if (server.fd === null) {
|
||||||
|
@ -140,24 +140,24 @@ if (process.argv[2] === 'child') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
||||||
throwInDomainErrHandler: false,
|
throwInDomainErrHandler: false,
|
||||||
useTryCatch: false
|
useTryCatch: false
|
||||||
});
|
});
|
||||||
|
|
||||||
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
||||||
throwInDomainErrHandler: false,
|
throwInDomainErrHandler: false,
|
||||||
useTryCatch: true
|
useTryCatch: true
|
||||||
});
|
});
|
||||||
|
|
||||||
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
||||||
throwInDomainErrHandler: true,
|
throwInDomainErrHandler: true,
|
||||||
useTryCatch: false
|
useTryCatch: false
|
||||||
});
|
});
|
||||||
|
|
||||||
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
testDomainExceptionHandling('--abort_on_uncaught_exception', {
|
||||||
throwInDomainErrHandler: true,
|
throwInDomainErrHandler: true,
|
||||||
useTryCatch: true
|
useTryCatch: true
|
||||||
});
|
});
|
||||||
|
|
||||||
testDomainExceptionHandling({
|
testDomainExceptionHandling({
|
||||||
throwInDomainErrHandler: false
|
throwInDomainErrHandler: false
|
||||||
|
@ -3,8 +3,8 @@ require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var events = require('events');
|
var events = require('events');
|
||||||
|
|
||||||
var e = new events.EventEmitter(),
|
const e = new events.EventEmitter();
|
||||||
num_args_emited = [];
|
const num_args_emited = [];
|
||||||
|
|
||||||
e.on('numArgs', function() {
|
e.on('numArgs', function() {
|
||||||
var numArgs = arguments.length;
|
var numArgs = arguments.length;
|
||||||
|
@ -7,50 +7,50 @@ var fs = require('fs');
|
|||||||
var fn = path.join(common.tmpDir, 'write.txt');
|
var fn = path.join(common.tmpDir, 'write.txt');
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
var file = fs.createWriteStream(fn, {
|
var file = fs.createWriteStream(fn, {
|
||||||
highWaterMark: 10
|
highWaterMark: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
var EXPECTED = '012345678910';
|
var EXPECTED = '012345678910';
|
||||||
|
|
||||||
var callbacks = {
|
var callbacks = {
|
||||||
open: -1,
|
open: -1,
|
||||||
drain: -2,
|
drain: -2,
|
||||||
close: -1
|
close: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
file
|
file
|
||||||
.on('open', function(fd) {
|
.on('open', function(fd) {
|
||||||
console.error('open!');
|
console.error('open!');
|
||||||
callbacks.open++;
|
callbacks.open++;
|
||||||
assert.equal('number', typeof fd);
|
assert.equal('number', typeof fd);
|
||||||
})
|
})
|
||||||
.on('error', function(err) {
|
.on('error', function(err) {
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
.on('drain', function() {
|
.on('drain', function() {
|
||||||
console.error('drain!', callbacks.drain);
|
console.error('drain!', callbacks.drain);
|
||||||
callbacks.drain++;
|
callbacks.drain++;
|
||||||
if (callbacks.drain == -1) {
|
if (callbacks.drain == -1) {
|
||||||
assert.equal(EXPECTED, fs.readFileSync(fn, 'utf8'));
|
assert.equal(EXPECTED, fs.readFileSync(fn, 'utf8'));
|
||||||
file.write(EXPECTED);
|
file.write(EXPECTED);
|
||||||
} else if (callbacks.drain == 0) {
|
} else if (callbacks.drain == 0) {
|
||||||
assert.equal(EXPECTED + EXPECTED, fs.readFileSync(fn, 'utf8'));
|
assert.equal(EXPECTED + EXPECTED, fs.readFileSync(fn, 'utf8'));
|
||||||
file.end();
|
file.end();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('close', function() {
|
.on('close', function() {
|
||||||
console.error('close!');
|
console.error('close!');
|
||||||
assert.strictEqual(file.bytesWritten, EXPECTED.length * 2);
|
assert.strictEqual(file.bytesWritten, EXPECTED.length * 2);
|
||||||
|
|
||||||
callbacks.close++;
|
callbacks.close++;
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
console.error('write after end should not be allowed');
|
console.error('write after end should not be allowed');
|
||||||
file.write('should not work anymore');
|
file.write('should not work anymore');
|
||||||
});
|
|
||||||
|
|
||||||
fs.unlinkSync(fn);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fs.unlinkSync(fn);
|
||||||
|
});
|
||||||
|
|
||||||
for (var i = 0; i < 11; i++) {
|
for (var i = 0; i < 11; i++) {
|
||||||
(function(i) {
|
(function(i) {
|
||||||
file.write('' + i);
|
file.write('' + i);
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs');
|
|
||||||
|
|
||||||
|
|
||||||
var filepath = path.join(common.tmpDir, 'write_pos.txt');
|
var filepath = path.join(common.tmpDir, 'write_pos.txt');
|
||||||
|
|
||||||
|
|
||||||
var cb_expected = 'write open close write open close write open close ',
|
const cb_expected = 'write open close write open close write open close ';
|
||||||
cb_occurred = '';
|
let cb_occurred = '';
|
||||||
|
|
||||||
var fileDataInitial = 'abcdefghijklmnopqrstuvwxyz';
|
var fileDataInitial = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
@ -126,8 +125,8 @@ function run_test_2() {
|
|||||||
function run_test_3() {
|
function run_test_3() {
|
||||||
var file, options;
|
var file, options;
|
||||||
|
|
||||||
var data = '\u2026\u2026', // 3 bytes * 2 = 6 bytes in UTF-8
|
const data = '\u2026\u2026'; // 3 bytes * 2 = 6 bytes in UTF-8
|
||||||
fileData;
|
let fileData;
|
||||||
|
|
||||||
options = { start: 10,
|
options = { start: 10,
|
||||||
flags: 'r+' };
|
flags: 'r+' };
|
||||||
|
@ -51,8 +51,8 @@ if (common.isWindows) {
|
|||||||
mode_sync = 0o644;
|
mode_sync = 0o644;
|
||||||
}
|
}
|
||||||
|
|
||||||
var file1 = path.join(common.fixturesDir, 'a.js'),
|
const file1 = path.join(common.fixturesDir, 'a.js');
|
||||||
file2 = path.join(common.fixturesDir, 'a1.js');
|
const file2 = path.join(common.fixturesDir, 'a1.js');
|
||||||
|
|
||||||
fs.chmod(file1, mode_async.toString(8), function(err) {
|
fs.chmod(file1, mode_async.toString(8), function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs'),
|
const fn = path.join(common.fixturesDir, 'non-existent');
|
||||||
fn = path.join(common.fixturesDir, 'non-existent'),
|
const existingFile = path.join(common.fixturesDir, 'exit.js');
|
||||||
existingFile = path.join(common.fixturesDir, 'exit.js'),
|
const existingFile2 = path.join(common.fixturesDir, 'create-file.js');
|
||||||
existingFile2 = path.join(common.fixturesDir, 'create-file.js'),
|
const existingDir = path.join(common.fixturesDir, 'empty');
|
||||||
existingDir = path.join(common.fixturesDir, 'empty'),
|
const existingDir2 = path.join(common.fixturesDir, 'keys');
|
||||||
existingDir2 = path.join(common.fixturesDir, 'keys');
|
|
||||||
|
|
||||||
// ASYNC_CALL
|
// ASYNC_CALL
|
||||||
|
|
||||||
@ -78,8 +77,8 @@ fs.readFile(fn, function(err) {
|
|||||||
|
|
||||||
// Sync
|
// Sync
|
||||||
|
|
||||||
var errors = [],
|
const errors = [];
|
||||||
expected = 0;
|
let expected = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
++expected;
|
++expected;
|
||||||
|
@ -29,7 +29,8 @@ 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('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('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
|
||||||
|
|
||||||
('+ +a +r +w rw wa war raw r++ a++ w++' +
|
('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx')
|
||||||
'x +x x+ rx rx+ wxx wax xwx xxx').split(' ').forEach(function(flags) {
|
.split(' ')
|
||||||
assert.throws(function() { fs._stringToFlags(flags); });
|
.forEach(function(flags) {
|
||||||
});
|
assert.throws(function() { fs._stringToFlags(flags); });
|
||||||
|
});
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
var path = require('path'),
|
const path = require('path');
|
||||||
Buffer = require('buffer').Buffer,
|
const Buffer = require('buffer').Buffer;
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
filepath = path.join(common.fixturesDir, 'x.txt'),
|
const filepath = path.join(common.fixturesDir, 'x.txt');
|
||||||
fd = fs.openSync(filepath, 'r'),
|
const fd = fs.openSync(filepath, 'r');
|
||||||
expected = 'xyz\n',
|
const expected = 'xyz\n';
|
||||||
bufferAsync = new Buffer(expected.length),
|
const bufferAsync = new Buffer(expected.length);
|
||||||
bufferSync = new Buffer(expected.length),
|
const bufferSync = new Buffer(expected.length);
|
||||||
readCalled = 0;
|
let readCalled = 0;
|
||||||
|
|
||||||
fs.read(fd, bufferAsync, 0, expected.length, 0, function(err, bytesRead) {
|
fs.read(fd, bufferAsync, 0, expected.length, 0, function(err, bytesRead) {
|
||||||
readCalled++;
|
readCalled++;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
var path = require('path'),
|
const path = require('path');
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
filepath = path.join(common.fixturesDir, 'x.txt'),
|
const filepath = path.join(common.fixturesDir, 'x.txt');
|
||||||
fd = fs.openSync(filepath, 'r'),
|
const fd = fs.openSync(filepath, 'r');
|
||||||
expected = 'xyz\n',
|
const expected = 'xyz\n';
|
||||||
readCalled = 0;
|
let readCalled = 0;
|
||||||
|
|
||||||
fs.read(fd, expected.length, 0, 'utf-8', function(err, str, bytesRead) {
|
fs.read(fd, expected.length, 0, 'utf-8', function(err, str, bytesRead) {
|
||||||
readCalled++;
|
readCalled++;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs'),
|
const fn = path.join(common.fixturesDir, 'empty.txt');
|
||||||
fn = path.join(common.fixturesDir, 'empty.txt');
|
|
||||||
|
|
||||||
fs.readFile(fn, function(err, data) {
|
fs.readFile(fn, function(err, data) {
|
||||||
assert.ok(data);
|
assert.ok(data);
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs'),
|
const fn = path.join(common.fixturesDir, 'empty.txt');
|
||||||
fn = path.join(common.fixturesDir, 'empty.txt');
|
|
||||||
|
|
||||||
tempFd(function(fd, close) {
|
tempFd(function(fd, close) {
|
||||||
fs.readFile(fd, function(err, data) {
|
fs.readFile(fd, function(err, data) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
common = require('../common'),
|
const common = require('../common');
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
path = require('path'),
|
const path = require('path');
|
||||||
dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink'),
|
const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink');
|
||||||
fileName = path.resolve(dirName, 'test.bin');
|
const fileName = path.resolve(dirName, 'test.bin');
|
||||||
|
|
||||||
var buf = new Buffer(512 * 1024);
|
var buf = new Buffer(512 * 1024);
|
||||||
buf.fill(42);
|
buf.fill(42);
|
||||||
|
@ -85,8 +85,8 @@ function test_simple_relative_symlink(callback) {
|
|||||||
console.log('1..0 # Skipped: symlink test (no privs)');
|
console.log('1..0 # Skipped: symlink test (no privs)');
|
||||||
return runNextTest();
|
return runNextTest();
|
||||||
}
|
}
|
||||||
var entry = common.tmpDir + '/symlink',
|
const entry = common.tmpDir + '/symlink';
|
||||||
expected = common.tmpDir + '/cycles/root.js';
|
const expected = common.tmpDir + '/cycles/root.js';
|
||||||
[
|
[
|
||||||
[entry, '../' + common.tmpDirName + '/cycles/root.js']
|
[entry, '../' + common.tmpDirName + '/cycles/root.js']
|
||||||
].forEach(function(t) {
|
].forEach(function(t) {
|
||||||
@ -111,8 +111,8 @@ function test_simple_absolute_symlink(callback) {
|
|||||||
|
|
||||||
console.log('using type=%s', type);
|
console.log('using type=%s', type);
|
||||||
|
|
||||||
var entry = tmpAbsDir + '/symlink',
|
const entry = tmpAbsDir + '/symlink';
|
||||||
expected = common.fixturesDir + '/nested-index/one';
|
const expected = common.fixturesDir + '/nested-index/one';
|
||||||
[
|
[
|
||||||
[entry, expected]
|
[entry, expected]
|
||||||
].forEach(function(t) {
|
].forEach(function(t) {
|
||||||
@ -490,8 +490,8 @@ function test_lying_cache_liar(cb) {
|
|||||||
});
|
});
|
||||||
assert(called === false);
|
assert(called === false);
|
||||||
|
|
||||||
var test = path.resolve('/a/b/c/d'),
|
const test = path.resolve('/a/b/c/d');
|
||||||
expect = path.resolve('/a/b/d');
|
const expect = path.resolve('/a/b/d');
|
||||||
var actual = fs.realpathSync(test, cache);
|
var actual = fs.realpathSync(test, cache);
|
||||||
assert.equal(expect, actual);
|
assert.equal(expect, actual);
|
||||||
fs.realpath(test, cache, function(er, actual) {
|
fs.realpath(test, cache, function(er, actual) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
var path = require('path'),
|
const path = require('path');
|
||||||
Buffer = require('buffer').Buffer,
|
const Buffer = require('buffer').Buffer;
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
filename = path.join(common.tmpDir, 'write.txt'),
|
const filename = path.join(common.tmpDir, 'write.txt');
|
||||||
expected = new Buffer('hello'),
|
const expected = new Buffer('hello');
|
||||||
openCalled = 0,
|
let openCalled = 0;
|
||||||
writeCalled = 0;
|
let writeCalled = 0;
|
||||||
|
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs');
|
|
||||||
|
|
||||||
var file = path.join(common.tmpDir, 'write.txt');
|
var file = path.join(common.tmpDir, 'write.txt');
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
var stream = fs.WriteStream(file),
|
const stream = fs.WriteStream(file);
|
||||||
_fs_close = fs.close,
|
const _fs_close = fs.close;
|
||||||
_fs_open = fs.open;
|
const _fs_open = fs.open;
|
||||||
|
|
||||||
// change the fs.open with an identical function after the WriteStream
|
// change the fs.open with an identical function after the WriteStream
|
||||||
// has pushed it onto its internal action queue, but before it's
|
// has pushed it onto its internal action queue, but before it's
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
var path = require('path'),
|
const fs = require('fs');
|
||||||
fs = require('fs');
|
|
||||||
|
|
||||||
var file = path.join(common.tmpDir, 'write.txt');
|
var file = path.join(common.tmpDir, 'write.txt');
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var stream = fs.WriteStream(file),
|
const stream = fs.WriteStream(file);
|
||||||
_fs_close = fs.close;
|
const _fs_close = fs.close;
|
||||||
|
|
||||||
fs.close = function(fd) {
|
fs.close = function(fd) {
|
||||||
assert.ok(fd, 'fs.close must not be called without an undefined fd.');
|
assert.ok(fd, 'fs.close must not be called without an undefined fd.');
|
||||||
|
@ -11,8 +11,8 @@ assert.equal('foo', global.baseFoo, 'x -> global.x in base level not working');
|
|||||||
|
|
||||||
assert.equal('bar', baseBar, 'global.x -> x in base level not working');
|
assert.equal('bar', baseBar, 'global.x -> x in base level not working');
|
||||||
|
|
||||||
var module = require('../fixtures/global/plain'),
|
var module = require('../fixtures/global/plain');
|
||||||
fooBar = module.fooBar;
|
const fooBar = module.fooBar;
|
||||||
|
|
||||||
assert.equal('foo', fooBar.foo, 'x -> global.x in sub level not working');
|
assert.equal('foo', fooBar.foo, 'x -> global.x in sub level not working');
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
common = require('../common'),
|
const common = require('../common');
|
||||||
http = require('http');
|
const http = require('http');
|
||||||
|
|
||||||
var complete;
|
var complete;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
http = require('http'),
|
const http = require('http');
|
||||||
domain = require('domain');
|
const domain = require('domain');
|
||||||
|
|
||||||
var gotDomainError = false;
|
var gotDomainError = false;
|
||||||
var d;
|
var d;
|
||||||
|
@ -15,8 +15,8 @@ var options = {
|
|||||||
//http.globalAgent.maxSockets = 15;
|
//http.globalAgent.maxSockets = 15;
|
||||||
|
|
||||||
var server = http.createServer(function(req, res) {
|
var server = http.createServer(function(req, res) {
|
||||||
var m = /\/(.*)/.exec(req.url),
|
const m = /\/(.*)/.exec(req.url);
|
||||||
reqid = parseInt(m[1], 10);
|
const reqid = parseInt(m[1], 10);
|
||||||
if ( reqid % 2 ) {
|
if ( reqid % 2 ) {
|
||||||
// do not reply the request
|
// do not reply the request
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
PORT = common.PORT,
|
const PORT = common.PORT;
|
||||||
SSLPORT = common.PORT + 1,
|
const SSLPORT = common.PORT + 1;
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
hostExpect = 'localhost',
|
const hostExpect = 'localhost';
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
path = require('path'),
|
const path = require('path');
|
||||||
fixtures = path.resolve(__dirname, '../fixtures/keys'),
|
const fixtures = path.resolve(__dirname, '../fixtures/keys');
|
||||||
options = {
|
const options = {
|
||||||
key: fs.readFileSync(fixtures + '/agent1-key.pem'),
|
key: fs.readFileSync(fixtures + '/agent1-key.pem'),
|
||||||
cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
|
cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
|
||||||
},
|
};
|
||||||
gotHttpsResp = false,
|
let gotHttpsResp = false;
|
||||||
gotHttpResp = false;
|
let gotHttpResp = false;
|
||||||
|
|
||||||
if (common.hasCrypto) {
|
if (common.hasCrypto) {
|
||||||
var https = require('https');
|
var https = require('https');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
http = require('http');
|
const http = require('http');
|
||||||
|
|
||||||
var testIndex = 0;
|
var testIndex = 0;
|
||||||
const testCount = 2 * 4 * 6;
|
const testCount = 2 * 4 * 6;
|
||||||
@ -10,24 +10,24 @@ const responseBody = 'Hi mars!';
|
|||||||
var server = http.createServer(function(req, res) {
|
var server = http.createServer(function(req, res) {
|
||||||
function reply(header) {
|
function reply(header) {
|
||||||
switch (testIndex % 4) {
|
switch (testIndex % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
res.writeHead(200, { a: header, b: header });
|
res.writeHead(200, { a: header, b: header });
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
res.setHeader('a', header);
|
res.setHeader('a', header);
|
||||||
res.setHeader('b', header);
|
res.setHeader('b', header);
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
res.setHeader('a', header);
|
res.setHeader('a', header);
|
||||||
res.writeHead(200, { b: header });
|
res.writeHead(200, { b: header });
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
res.setHeader('a', [header]);
|
res.setHeader('a', [header]);
|
||||||
res.writeHead(200, { b: header });
|
res.writeHead(200, { b: header });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert.fail(null, null, 'unreachable');
|
assert.fail(null, null, 'unreachable');
|
||||||
}
|
}
|
||||||
res.write(responseBody);
|
res.write(responseBody);
|
||||||
if (testIndex % 8 < 4) {
|
if (testIndex % 8 < 4) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
httpServer = http.createServer(reqHandler);
|
const httpServer = http.createServer(reqHandler);
|
||||||
|
|
||||||
function reqHandler(req, res) {
|
function reqHandler(req, res) {
|
||||||
console.log('Got request: ' + req.headers.host + ' ' + req.url);
|
console.log('Got request: ' + req.headers.host + ' ' + req.url);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var http = require('http'),
|
const http = require('http');
|
||||||
assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
if (!common.hasMultiLocalhost()) {
|
if (!common.hasMultiLocalhost()) {
|
||||||
console.log('1..0 # Skipped: platform-specific test.');
|
console.log('1..0 # Skipped: platform-specific test.');
|
||||||
|
@ -333,8 +333,8 @@ function expectBody(expected) {
|
|||||||
assert.equal(versionMinor, 1);
|
assert.equal(versionMinor, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
var body_part = 0,
|
let body_part = 0;
|
||||||
body_parts = ['123', '123456', '1234567890'];
|
const body_parts = ['123', '123456', '1234567890'];
|
||||||
|
|
||||||
var onBody = function(buf, start, len) {
|
var onBody = function(buf, start, len) {
|
||||||
var body = '' + buf.slice(start, start + len);
|
var body = '' + buf.slice(start, start + len);
|
||||||
@ -371,8 +371,8 @@ function expectBody(expected) {
|
|||||||
assert.equal(versionMinor, 1);
|
assert.equal(versionMinor, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
var body_part = 0,
|
let body_part = 0;
|
||||||
body_parts =
|
const body_parts =
|
||||||
['123', '123456', '123456789', '123456789ABC', '123456789ABCDEF'];
|
['123', '123456', '123456789', '123456789ABC', '123456789ABCDEF'];
|
||||||
|
|
||||||
var onBody = function(buf, start, len) {
|
var onBody = function(buf, start, len) {
|
||||||
|
@ -23,20 +23,22 @@ server.listen(port, function() {
|
|||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
function createRequest() {
|
function createRequest() {
|
||||||
var req = http.request({port: port, path: '/', agent: agent},
|
const req = http.request(
|
||||||
function(res) {
|
{port: port, path: '/', agent: agent},
|
||||||
req.clearTimeout(callback);
|
function(res) {
|
||||||
|
req.clearTimeout(callback);
|
||||||
|
|
||||||
res.on('end', function() {
|
res.on('end', function() {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (count == 11) {
|
if (count == 11) {
|
||||||
server.close();
|
server.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
res.resume();
|
res.resume();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
req.setTimeout(1000, callback);
|
req.setTimeout(1000, callback);
|
||||||
return req;
|
return req;
|
||||||
|
@ -8,12 +8,12 @@ if (!common.hasCrypto) {
|
|||||||
}
|
}
|
||||||
var https = require('https');
|
var https = require('https');
|
||||||
|
|
||||||
var fs = require('fs'),
|
const fs = require('fs');
|
||||||
options = {
|
const options = {
|
||||||
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
||||||
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
||||||
},
|
};
|
||||||
httpsServer = https.createServer(options, reqHandler);
|
const httpsServer = https.createServer(options, reqHandler);
|
||||||
|
|
||||||
function reqHandler(req, res) {
|
function reqHandler(req, res) {
|
||||||
console.log('Got request: ' + req.headers.host + ' ' + req.url);
|
console.log('Got request: ' + req.headers.host + ' ' + req.url);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
fs = require('fs'),
|
const fs = require('fs');
|
||||||
assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
console.log('1..0 # Skipped: missing crypto');
|
console.log('1..0 # Skipped: missing crypto');
|
||||||
|
@ -14,7 +14,8 @@ net.Server().listen({ port: '' + common.PORT }, close);
|
|||||||
1 / 0,
|
1 / 0,
|
||||||
-1 / 0,
|
-1 / 0,
|
||||||
'+Infinity',
|
'+Infinity',
|
||||||
'-Infinity' ].forEach(function(port) {
|
'-Infinity'
|
||||||
|
].forEach(function(port) {
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
net.Server().listen({ port: port }, assert.fail);
|
net.Server().listen({ port: port }, assert.fail);
|
||||||
}, /"port" option should be >= 0 and < 65536/i);
|
}, /"port" option should be >= 0 and < 65536/i);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
var connections = 0,
|
let connections = 0;
|
||||||
dataEvents = 0,
|
let dataEvents = 0;
|
||||||
conn;
|
let conn;
|
||||||
|
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
|
@ -38,14 +38,14 @@ var server = net.createServer(function(socket) {
|
|||||||
socket.end();
|
socket.end();
|
||||||
|
|
||||||
}).listen(common.PORT, function() {
|
}).listen(common.PORT, function() {
|
||||||
var conn = net.connect(common.PORT);
|
var conn = net.connect(common.PORT);
|
||||||
conn.on('data', function(buf) {
|
conn.on('data', function(buf) {
|
||||||
conn.pause();
|
conn.pause();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
conn.destroy();
|
conn.destroy();
|
||||||
}, 20);
|
}, 20);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.equal(server.connections, 0);
|
assert.equal(server.connections, 0);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var order = [],
|
const order = [];
|
||||||
exceptionHandled = false;
|
let exceptionHandled = false;
|
||||||
|
|
||||||
// This nextTick function will throw an error. It should only be called once.
|
// This nextTick function will throw an error. It should only be called once.
|
||||||
// When it throws an error, it should still get removed from the queue.
|
// When it throws an error, it should still get removed from the queue.
|
||||||
|
@ -86,7 +86,7 @@ function checkErrors(path) {
|
|||||||
errors.forEach(function(errorCase) {
|
errors.forEach(function(errorCase) {
|
||||||
try {
|
try {
|
||||||
path[errorCase.method].apply(path, errorCase.input);
|
path[errorCase.method].apply(path, errorCase.input);
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
assert.ok(err instanceof TypeError);
|
assert.ok(err instanceof TypeError);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
errorCase.message.test(err.message),
|
errorCase.message.test(err.message),
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
path = require('path'),
|
const path = require('path');
|
||||||
child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
|
|
||||||
var nodeBinary = process.argv[0];
|
var nodeBinary = process.argv[0];
|
||||||
|
|
||||||
|
@ -234,23 +234,27 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' +
|
|||||||
var promise2;
|
var promise2;
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('unhandledRejection should not be triggered if a promise catch is' +
|
asyncTest(
|
||||||
' attached synchronously upon the promise\'s creation',
|
'unhandledRejection should not be triggered if a promise catch is' +
|
||||||
function(done) {
|
' attached synchronously upon the promise\'s creation',
|
||||||
var e = new Error();
|
function(done) {
|
||||||
onUnhandledFail(done);
|
var e = new Error();
|
||||||
Promise.reject(e).then(common.fail, function() {});
|
onUnhandledFail(done);
|
||||||
});
|
Promise.reject(e).then(common.fail, function() {});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
asyncTest('unhandledRejection should not be triggered if a promise catch is' +
|
asyncTest(
|
||||||
' attached synchronously upon the promise\'s creation',
|
'unhandledRejection should not be triggered if a promise catch is' +
|
||||||
function(done) {
|
' attached synchronously upon the promise\'s creation',
|
||||||
var e = new Error();
|
function(done) {
|
||||||
onUnhandledFail(done);
|
var e = new Error();
|
||||||
new Promise(function(_, reject) {
|
onUnhandledFail(done);
|
||||||
reject(e);
|
new Promise(function(_, reject) {
|
||||||
}).then(common.fail, function() {});
|
reject(e);
|
||||||
});
|
}).then(common.fail, function() {});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
|
asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
|
||||||
' prevent unhandledRejection', function(done) {
|
' prevent unhandledRejection', function(done) {
|
||||||
@ -360,19 +364,21 @@ asyncTest('A rejected promise derived from throwing in a fulfillment handler' +
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('A rejected promise derived from returning a synchronously-rejected' +
|
asyncTest(
|
||||||
' promise in a fulfillment handler does trigger unhandledRejection',
|
'A rejected promise derived from returning a synchronously-rejected' +
|
||||||
function(done) {
|
' promise in a fulfillment handler does trigger unhandledRejection',
|
||||||
var e = new Error();
|
function(done) {
|
||||||
var _promise;
|
var e = new Error();
|
||||||
onUnhandledSucceed(done, function(reason, promise) {
|
var _promise;
|
||||||
assert.strictEqual(e, reason);
|
onUnhandledSucceed(done, function(reason, promise) {
|
||||||
assert.strictEqual(_promise, promise);
|
assert.strictEqual(e, reason);
|
||||||
});
|
assert.strictEqual(_promise, promise);
|
||||||
_promise = Promise.resolve().then(function() {
|
});
|
||||||
return Promise.reject(e);
|
_promise = Promise.resolve().then(function() {
|
||||||
});
|
return Promise.reject(e);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Combinations with Promise.all
|
// Combinations with Promise.all
|
||||||
asyncTest('Catching the Promise.all() of a collection that includes a' +
|
asyncTest('Catching the Promise.all() of a collection that includes a' +
|
||||||
@ -382,21 +388,23 @@ asyncTest('Catching the Promise.all() of a collection that includes a' +
|
|||||||
Promise.all([Promise.reject(e)]).then(common.fail, function() {});
|
Promise.all([Promise.reject(e)]).then(common.fail, function() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('Catching the Promise.all() of a collection that includes a ' +
|
asyncTest(
|
||||||
'nextTick-async rejected promise prevents unhandledRejection',
|
'Catching the Promise.all() of a collection that includes a ' +
|
||||||
function(done) {
|
'nextTick-async rejected promise prevents unhandledRejection',
|
||||||
var e = new Error();
|
function(done) {
|
||||||
onUnhandledFail(done);
|
var e = new Error();
|
||||||
var p = new Promise(function(_, reject) {
|
onUnhandledFail(done);
|
||||||
process.nextTick(function() {
|
var p = new Promise(function(_, reject) {
|
||||||
reject(e);
|
process.nextTick(function() {
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
p = Promise.all([p]);
|
||||||
p = Promise.all([p]);
|
process.nextTick(function() {
|
||||||
process.nextTick(function() {
|
p.then(common.fail, function() {});
|
||||||
p.then(common.fail, function() {});
|
});
|
||||||
});
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
asyncTest('Failing to catch the Promise.all() of a collection that includes' +
|
asyncTest('Failing to catch the Promise.all() of a collection that includes' +
|
||||||
' a rejected promise triggers unhandledRejection for the returned' +
|
' a rejected promise triggers unhandledRejection for the returned' +
|
||||||
@ -513,26 +521,28 @@ asyncTest('Waiting for some combination of promise microtasks + ' +
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('Waiting for some combination of promise microtasks +' +
|
asyncTest(
|
||||||
' process.nextTick to attach a catch handler is still soon enough' +
|
'Waiting for some combination of promise microtasks +' +
|
||||||
' to prevent unhandledRejection: inside setImmediate',
|
' process.nextTick to attach a catch handler is still soon enough' +
|
||||||
function(done) {
|
' to prevent unhandledRejection: inside setImmediate',
|
||||||
var e = new Error();
|
function(done) {
|
||||||
onUnhandledFail(done);
|
var e = new Error();
|
||||||
|
onUnhandledFail(done);
|
||||||
|
|
||||||
setImmediate(function() {
|
setImmediate(function() {
|
||||||
var a = Promise.reject(e);
|
var a = Promise.reject(e);
|
||||||
Promise.resolve().then(function() {
|
Promise.resolve().then(function() {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
Promise.resolve().then(function() {
|
Promise.resolve().then(function() {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
a.catch(function() {});
|
a.catch(function() {});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
asyncTest('Waiting for some combination of promise microtasks +' +
|
asyncTest('Waiting for some combination of promise microtasks +' +
|
||||||
' process.nextTick to attach a catch handler is still soon enough' +
|
' process.nextTick to attach a catch handler is still soon enough' +
|
||||||
@ -612,28 +622,30 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch' +
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest('Promise unhandledRejection handler does not interfere with domain' +
|
asyncTest(
|
||||||
' error handlers being given exceptions thrown from nextTick.',
|
'Promise unhandledRejection handler does not interfere with domain' +
|
||||||
function(done) {
|
' error handlers being given exceptions thrown from nextTick.',
|
||||||
var d = domain.create();
|
function(done) {
|
||||||
var domainReceivedError;
|
var d = domain.create();
|
||||||
d.on('error', function(e) {
|
var domainReceivedError;
|
||||||
domainReceivedError = e;
|
d.on('error', function(e) {
|
||||||
});
|
domainReceivedError = e;
|
||||||
d.run(function() {
|
|
||||||
var e = new Error('error');
|
|
||||||
var domainError = new Error('domain error');
|
|
||||||
onUnhandledSucceed(done, function(reason, promise) {
|
|
||||||
assert.strictEqual(reason, e);
|
|
||||||
assert.strictEqual(domainReceivedError, domainError);
|
|
||||||
d.dispose();
|
|
||||||
});
|
});
|
||||||
Promise.reject(e);
|
d.run(function() {
|
||||||
process.nextTick(function() {
|
var e = new Error('error');
|
||||||
throw domainError;
|
var domainError = new Error('domain error');
|
||||||
|
onUnhandledSucceed(done, function(reason, promise) {
|
||||||
|
assert.strictEqual(reason, e);
|
||||||
|
assert.strictEqual(domainReceivedError, domainError);
|
||||||
|
d.dispose();
|
||||||
|
});
|
||||||
|
Promise.reject(e);
|
||||||
|
process.nextTick(function() {
|
||||||
|
throw domainError;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
asyncTest('nextTick is immediately scheduled when called inside an event' +
|
asyncTest('nextTick is immediately scheduled when called inside an event' +
|
||||||
' handler', function(done) {
|
' handler', function(done) {
|
||||||
|
@ -182,12 +182,11 @@ assert.equal(
|
|||||||
|
|
||||||
// Test removing limit
|
// Test removing limit
|
||||||
function testUnlimitedKeys() {
|
function testUnlimitedKeys() {
|
||||||
var query = {},
|
const query = {};
|
||||||
url;
|
|
||||||
|
|
||||||
for (var i = 0; i < 2000; i++) query[i] = i;
|
for (var i = 0; i < 2000; i++) query[i] = i;
|
||||||
|
|
||||||
url = qs.stringify(query);
|
const url = qs.stringify(query);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
|
Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
|
||||||
|
@ -259,7 +259,7 @@ function isWarned(emitter) {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
fi.emit('data', 'fooX');
|
fi.emit('data', 'fooX');
|
||||||
} catch(e) { }
|
} catch (e) { }
|
||||||
fi.emit('data', 'bar');
|
fi.emit('data', 'bar');
|
||||||
assert.equal(keys.join(''), 'fooXbar');
|
assert.equal(keys.join(''), 'fooXbar');
|
||||||
rli.close();
|
rli.close();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
vm = require('vm');
|
const vm = require('vm');
|
||||||
|
|
||||||
assert.doesNotThrow(function() {
|
assert.doesNotThrow(function() {
|
||||||
var context = vm.createContext({ process: process });
|
var context = vm.createContext({ process: process });
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
// Create a dummy stream that does nothing
|
// Create a dummy stream that does nothing
|
||||||
const stream = new common.ArrayStream();
|
const stream = new common.ArrayStream();
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
|
|
||||||
const stream = require('stream'),
|
const stream = require('stream');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
var output = '';
|
var output = '';
|
||||||
const inputStream = new stream.PassThrough();
|
const inputStream = new stream.PassThrough();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
repl = require('repl'),
|
const repl = require('repl');
|
||||||
terminalExit = 0,
|
let terminalExit = 0;
|
||||||
regularExit = 0;
|
let regularExit = 0;
|
||||||
|
|
||||||
// Create a dummy stream that does nothing
|
// Create a dummy stream that does nothing
|
||||||
const stream = new common.ArrayStream();
|
const stream = new common.ArrayStream();
|
||||||
|
@ -8,30 +8,32 @@ const REPL = require('internal/repl');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const inspect = require('util').inspect;
|
const inspect = require('util').inspect;
|
||||||
|
|
||||||
const tests = [{
|
const tests = [
|
||||||
env: {},
|
{
|
||||||
expected: { terminal: true, useColors: true }
|
env: {},
|
||||||
},
|
expected: { terminal: true, useColors: true }
|
||||||
{
|
},
|
||||||
env: { NODE_DISABLE_COLORS: '1' },
|
{
|
||||||
expected: { terminal: true, useColors: false }
|
env: { NODE_DISABLE_COLORS: '1' },
|
||||||
},
|
expected: { terminal: true, useColors: false }
|
||||||
{
|
},
|
||||||
env: { NODE_NO_READLINE: '1' },
|
{
|
||||||
expected: { terminal: false, useColors: false }
|
env: { NODE_NO_READLINE: '1' },
|
||||||
},
|
expected: { terminal: false, useColors: false }
|
||||||
{
|
},
|
||||||
env: { TERM: 'dumb' },
|
{
|
||||||
expected: { terminal: true, useColors: false }
|
env: { TERM: 'dumb' },
|
||||||
},
|
expected: { terminal: true, useColors: false }
|
||||||
{
|
},
|
||||||
env: { NODE_NO_READLINE: '1', NODE_DISABLE_COLORS: '1' },
|
{
|
||||||
expected: { terminal: false, useColors: false }
|
env: { NODE_NO_READLINE: '1', NODE_DISABLE_COLORS: '1' },
|
||||||
},
|
expected: { terminal: false, useColors: false }
|
||||||
{
|
},
|
||||||
env: { NODE_NO_READLINE: '0' },
|
{
|
||||||
expected: { terminal: true, useColors: true }
|
env: { NODE_NO_READLINE: '0' },
|
||||||
}];
|
expected: { terminal: true, useColors: true }
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
function run(test) {
|
function run(test) {
|
||||||
const env = test.env;
|
const env = test.env;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
common.globalCheck = false;
|
common.globalCheck = false;
|
||||||
|
|
||||||
|
@ -79,107 +79,109 @@ const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
|
|||||||
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
|
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
|
||||||
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
|
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
|
||||||
|
|
||||||
const tests = [{
|
const tests = [
|
||||||
env: { NODE_REPL_HISTORY: '' },
|
{
|
||||||
test: [UP],
|
env: { NODE_REPL_HISTORY: '' },
|
||||||
expected: [prompt, replDisabled, prompt]
|
test: [UP],
|
||||||
},
|
expected: [prompt, replDisabled, prompt]
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: '',
|
|
||||||
NODE_REPL_HISTORY_FILE: enoentHistoryPath },
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt, replDisabled, prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: '',
|
|
||||||
NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt, replDisabled, prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY_FILE: emptyHistoryPath },
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt, convertMsg, prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY_FILE: defaultHistoryPath },
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt, sameHistoryFilePaths, prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: historyPath },
|
|
||||||
test: [UP, CLEAR],
|
|
||||||
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: historyPath,
|
|
||||||
NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
|
||||||
test: [UP, CLEAR],
|
|
||||||
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: historyPath,
|
|
||||||
NODE_REPL_HISTORY_FILE: '' },
|
|
||||||
test: [UP, CLEAR],
|
|
||||||
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: {},
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
|
||||||
test: [UP, CLEAR, '\'42\'', ENTER],
|
|
||||||
expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
|
|
||||||
'4', '2', '\'', '\'42\'\n', prompt, prompt],
|
|
||||||
after: function ensureHistoryFixture() {
|
|
||||||
// XXX(Fishrock123) Make sure nothing weird happened to our fixture
|
|
||||||
// or it's temporary copy.
|
|
||||||
// Sometimes this test used to erase the fixture and I'm not sure why.
|
|
||||||
const history = fs.readFileSync(historyFixturePath, 'utf8');
|
|
||||||
assert.strictEqual(history,
|
|
||||||
'\'you look fabulous today\'\n\'Stay Fresh~\'\n');
|
|
||||||
const historyCopy = fs.readFileSync(historyPath, 'utf8');
|
|
||||||
assert.strictEqual(historyCopy, '\'you look fabulous today\'' + os.EOL +
|
|
||||||
'\'Stay Fresh~\'' + os.EOL);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ // Requires the above testcase
|
|
||||||
env: {},
|
|
||||||
test: [UP, UP, ENTER],
|
|
||||||
expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
|
|
||||||
prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: historyPath,
|
|
||||||
NODE_REPL_HISTORY_SIZE: 1 },
|
|
||||||
test: [UP, UP, CLEAR],
|
|
||||||
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
|
|
||||||
NODE_REPL_HISTORY_SIZE: 1 },
|
|
||||||
test: [UP, UP, UP, CLEAR],
|
|
||||||
expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: { NODE_REPL_HISTORY: historyPathFail,
|
|
||||||
NODE_REPL_HISTORY_SIZE: 1 },
|
|
||||||
test: [UP],
|
|
||||||
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
|
|
||||||
},
|
|
||||||
{ // Make sure this is always the last test, since we change os.homedir()
|
|
||||||
before: function mockHomedirFailure() {
|
|
||||||
// Mock os.homedir() failure
|
|
||||||
os.homedir = function() {
|
|
||||||
throw new Error('os.homedir() failure');
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
env: {},
|
{
|
||||||
test: [UP],
|
env: { NODE_REPL_HISTORY: '',
|
||||||
expected: [prompt, homedirErr, prompt, replDisabled, prompt]
|
NODE_REPL_HISTORY_FILE: enoentHistoryPath },
|
||||||
}];
|
test: [UP],
|
||||||
|
expected: [prompt, replDisabled, prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: '',
|
||||||
|
NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt, replDisabled, prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY_FILE: emptyHistoryPath },
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt, convertMsg, prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY_FILE: defaultHistoryPath },
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt, sameHistoryFilePaths, prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: historyPath },
|
||||||
|
test: [UP, CLEAR],
|
||||||
|
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: historyPath,
|
||||||
|
NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
||||||
|
test: [UP, CLEAR],
|
||||||
|
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: historyPath,
|
||||||
|
NODE_REPL_HISTORY_FILE: '' },
|
||||||
|
test: [UP, CLEAR],
|
||||||
|
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: {},
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
|
||||||
|
test: [UP, CLEAR, '\'42\'', ENTER],
|
||||||
|
expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
|
||||||
|
'4', '2', '\'', '\'42\'\n', prompt, prompt],
|
||||||
|
after: function ensureHistoryFixture() {
|
||||||
|
// XXX(Fishrock123) Make sure nothing weird happened to our fixture
|
||||||
|
// or it's temporary copy.
|
||||||
|
// Sometimes this test used to erase the fixture and I'm not sure why.
|
||||||
|
const history = fs.readFileSync(historyFixturePath, 'utf8');
|
||||||
|
assert.strictEqual(history,
|
||||||
|
'\'you look fabulous today\'\n\'Stay Fresh~\'\n');
|
||||||
|
const historyCopy = fs.readFileSync(historyPath, 'utf8');
|
||||||
|
assert.strictEqual(historyCopy, '\'you look fabulous today\'' + os.EOL +
|
||||||
|
'\'Stay Fresh~\'' + os.EOL);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ // Requires the above testcase
|
||||||
|
env: {},
|
||||||
|
test: [UP, UP, ENTER],
|
||||||
|
expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
|
||||||
|
prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: historyPath,
|
||||||
|
NODE_REPL_HISTORY_SIZE: 1 },
|
||||||
|
test: [UP, UP, CLEAR],
|
||||||
|
expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
|
||||||
|
NODE_REPL_HISTORY_SIZE: 1 },
|
||||||
|
test: [UP, UP, UP, CLEAR],
|
||||||
|
expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
env: { NODE_REPL_HISTORY: historyPathFail,
|
||||||
|
NODE_REPL_HISTORY_SIZE: 1 },
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
|
||||||
|
},
|
||||||
|
{ // Make sure this is always the last test, since we change os.homedir()
|
||||||
|
before: function mockHomedirFailure() {
|
||||||
|
// Mock os.homedir() failure
|
||||||
|
os.homedir = function() {
|
||||||
|
throw new Error('os.homedir() failure');
|
||||||
|
};
|
||||||
|
},
|
||||||
|
env: {},
|
||||||
|
test: [UP],
|
||||||
|
expected: [prompt, homedirErr, prompt, replDisabled, prompt]
|
||||||
|
}
|
||||||
|
];
|
||||||
const numtests = tests.length;
|
const numtests = tests.length;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
// https://github.com/joyent/node/issues/3226
|
// https://github.com/joyent/node/issues/3226
|
||||||
|
|
||||||
|
@ -5,17 +5,17 @@ var assert = require('assert');
|
|||||||
common.globalCheck = false;
|
common.globalCheck = false;
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
var net = require('net'),
|
const net = require('net');
|
||||||
repl = require('repl'),
|
const repl = require('repl');
|
||||||
message = 'Read, Eval, Print Loop',
|
const message = 'Read, Eval, Print Loop';
|
||||||
prompt_unix = 'node via Unix socket> ',
|
const prompt_unix = 'node via Unix socket> ';
|
||||||
prompt_tcp = 'node via TCP socket> ',
|
const prompt_tcp = 'node via TCP socket> ';
|
||||||
prompt_multiline = '... ',
|
const prompt_multiline = '... ';
|
||||||
prompt_npm = 'npm should be run outside of the ' +
|
const prompt_npm = 'npm should be run outside of the ' +
|
||||||
'node repl, in your normal shell.\n' +
|
'node repl, in your normal shell.\n' +
|
||||||
'(Press Control-D to exit.)\n',
|
'(Press Control-D to exit.)\n';
|
||||||
expect_npm = prompt_npm + prompt_unix,
|
const expect_npm = prompt_npm + prompt_unix;
|
||||||
server_tcp, server_unix, client_tcp, client_unix, timer;
|
var server_tcp, server_unix, client_tcp, client_unix, timer;
|
||||||
|
|
||||||
|
|
||||||
// absolute path to test/fixtures/a.js
|
// absolute path to test/fixtures/a.js
|
||||||
|
@ -10,8 +10,8 @@ if (common.isWindows) {
|
|||||||
|
|
||||||
console.log('process.pid: ' + process.pid);
|
console.log('process.pid: ' + process.pid);
|
||||||
|
|
||||||
var first = 0,
|
let first = 0;
|
||||||
second = 0;
|
let second = 0;
|
||||||
|
|
||||||
var sighup = false;
|
var sighup = false;
|
||||||
|
|
||||||
|
@ -44,24 +44,24 @@ function test(decode, uncork, multi, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var expectChunks = decode ?
|
var expectChunks = decode ?
|
||||||
[
|
[
|
||||||
{ encoding: 'buffer',
|
{ encoding: 'buffer',
|
||||||
chunk: [104, 101, 108, 108, 111, 44, 32] },
|
chunk: [104, 101, 108, 108, 111, 44, 32] },
|
||||||
{ encoding: 'buffer',
|
{ encoding: 'buffer',
|
||||||
chunk: [119, 111, 114, 108, 100] },
|
chunk: [119, 111, 114, 108, 100] },
|
||||||
{ encoding: 'buffer',
|
{ encoding: 'buffer',
|
||||||
chunk: [33] },
|
chunk: [33] },
|
||||||
{ encoding: 'buffer',
|
{ encoding: 'buffer',
|
||||||
chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
|
chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
|
||||||
{ encoding: 'buffer',
|
{ encoding: 'buffer',
|
||||||
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
|
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
|
||||||
] : [
|
] : [
|
||||||
{ encoding: 'ascii', chunk: 'hello, ' },
|
{ encoding: 'ascii', chunk: 'hello, ' },
|
||||||
{ encoding: 'utf8', chunk: 'world' },
|
{ encoding: 'utf8', chunk: 'world' },
|
||||||
{ encoding: 'buffer', chunk: [33] },
|
{ encoding: 'buffer', chunk: [33] },
|
||||||
{ encoding: 'binary', chunk: '\nand then...' },
|
{ encoding: 'binary', chunk: '\nand then...' },
|
||||||
{ encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
|
{ encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
|
||||||
];
|
];
|
||||||
|
|
||||||
var actualChunks;
|
var actualChunks;
|
||||||
w._writev = function(chunks, cb) {
|
w._writev = function(chunks, cb) {
|
||||||
|
@ -21,7 +21,7 @@ try {
|
|||||||
// Try to allocate memory first then force gc so future allocations succeed.
|
// Try to allocate memory first then force gc so future allocations succeed.
|
||||||
new Buffer(2 * kStringMaxLength);
|
new Buffer(2 * kStringMaxLength);
|
||||||
gc();
|
gc();
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
// If the exception is not due to memory confinement then rethrow it.
|
// If the exception is not due to memory confinement then rethrow it.
|
||||||
if (e.message !== 'Invalid array buffer length') throw (e);
|
if (e.message !== 'Invalid array buffer length') throw (e);
|
||||||
console.log(skipMessage);
|
console.log(skipMessage);
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var immediateA = false,
|
let immediateA = false;
|
||||||
immediateB = false,
|
let immediateB = false;
|
||||||
immediateC = [],
|
let immediateC = [];
|
||||||
before;
|
let before;
|
||||||
|
|
||||||
setImmediate(function() {
|
setImmediate(function() {
|
||||||
try {
|
try {
|
||||||
immediateA = process.hrtime(before);
|
immediateA = process.hrtime(before);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.log('failed to get hrtime with offset');
|
console.log('failed to get hrtime with offset');
|
||||||
}
|
}
|
||||||
clearImmediate(immediateB);
|
clearImmediate(immediateB);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var immediateThis, intervalThis, timeoutThis,
|
let immediateThis, intervalThis, timeoutThis;
|
||||||
immediateArgsThis, intervalArgsThis, timeoutArgsThis;
|
let immediateArgsThis, intervalArgsThis, timeoutArgsThis;
|
||||||
|
|
||||||
var immediateHandler = setImmediate(function() {
|
var immediateHandler = setImmediate(function() {
|
||||||
immediateThis = this;
|
immediateThis = this;
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var interval_fired = false,
|
let interval_fired = false;
|
||||||
timeout_fired = false,
|
let timeout_fired = false;
|
||||||
unref_interval = false,
|
let unref_interval = false;
|
||||||
unref_timer = false,
|
let unref_timer = false;
|
||||||
unref_callbacks = 0,
|
let unref_callbacks = 0;
|
||||||
interval, check_unref, checks = 0;
|
let interval, check_unref, checks = 0;
|
||||||
|
|
||||||
var LONG_TIME = 10 * 1000;
|
var LONG_TIME = 10 * 1000;
|
||||||
var SHORT_TIME = 100;
|
var SHORT_TIME = 100;
|
||||||
|
@ -23,12 +23,12 @@ tls.createServer({
|
|||||||
}).listen(common.PORT);
|
}).listen(common.PORT);
|
||||||
|
|
||||||
var socket = tls.connect({
|
var socket = tls.connect({
|
||||||
port: common.PORT,
|
port: common.PORT,
|
||||||
ca: cert,
|
ca: cert,
|
||||||
// No host set here. 'localhost' is the default,
|
// No host set here. 'localhost' is the default,
|
||||||
// but tls.checkServerIdentity() breaks before the fix with:
|
// but tls.checkServerIdentity() breaks before the fix with:
|
||||||
// Error: Hostname/IP doesn't match certificate's altnames:
|
// Error: Hostname/IP doesn't match certificate's altnames:
|
||||||
// "Host: undefined. is not cert's CN: localhost"
|
// "Host: undefined. is not cert's CN: localhost"
|
||||||
}, function() {
|
}, function() {
|
||||||
assert(socket.authorized);
|
assert(socket.authorized);
|
||||||
process.exit();
|
process.exit();
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var assert = require('assert'),
|
const common = require('../common');
|
||||||
fs = require('fs'),
|
const assert = require('assert');
|
||||||
path = require('path'),
|
const fs = require('fs');
|
||||||
tls = require('tls'),
|
const path = require('path');
|
||||||
stream = require('stream'),
|
const tls = require('tls');
|
||||||
net = require('net');
|
const stream = require('stream');
|
||||||
|
const net = require('net');
|
||||||
var common = require('../common');
|
|
||||||
|
|
||||||
var server;
|
var server;
|
||||||
var cert_dir = path.resolve(__dirname, '../fixtures'),
|
var cert_dir = path.resolve(__dirname, '../fixtures');
|
||||||
options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
|
var options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
|
||||||
cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
|
cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
|
||||||
ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
|
ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
|
||||||
ciphers: 'AES256-GCM-SHA384' };
|
ciphers: 'AES256-GCM-SHA384' };
|
||||||
|
@ -5,9 +5,9 @@ if (!process.features.tls_npn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
console.log('1..0 # Skipped: missing crypto');
|
console.log('1..0 # Skipped: missing crypto');
|
||||||
@ -69,8 +69,8 @@ var clientsOptions = [{
|
|||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var serverResults = [],
|
const serverResults = [];
|
||||||
clientsResults = [];
|
const clientsResults = [];
|
||||||
|
|
||||||
var server = tls.createServer(serverOptions, function(c) {
|
var server = tls.createServer(serverOptions, function(c) {
|
||||||
serverResults.push(c.npnProtocol);
|
serverResults.push(c.npnProtocol);
|
||||||
|
@ -87,15 +87,14 @@ var testCases =
|
|||||||
renegotiate: false,
|
renegotiate: false,
|
||||||
CAs: ['ca2-cert'],
|
CAs: ['ca2-cert'],
|
||||||
crl: 'ca2-crl',
|
crl: 'ca2-crl',
|
||||||
clients:
|
clients: [
|
||||||
[
|
|
||||||
{ name: 'agent1', shouldReject: true, shouldAuth: false },
|
{ name: 'agent1', shouldReject: true, shouldAuth: false },
|
||||||
{ name: 'agent2', shouldReject: true, shouldAuth: false },
|
{ name: 'agent2', shouldReject: true, shouldAuth: false },
|
||||||
{ name: 'agent3', shouldReject: false, shouldAuth: true },
|
{ name: 'agent3', shouldReject: false, shouldAuth: true },
|
||||||
// Agent4 has a cert in the CRL.
|
// Agent4 has a cert in the CRL.
|
||||||
{ name: 'agent4', shouldReject: true, shouldAuth: false },
|
{ name: 'agent4', shouldReject: true, shouldAuth: false },
|
||||||
{ name: 'nocert', shouldReject: true }
|
{ name: 'nocert', shouldReject: true }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ if (!process.features.tls_sni) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
console.log('1..0 # Skipped: missing crypto');
|
console.log('1..0 # Skipped: missing crypto');
|
||||||
@ -99,12 +99,12 @@ var clientsOptions = [{
|
|||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var serverResults = [],
|
const serverResults = [];
|
||||||
clientResults = [],
|
const clientResults = [];
|
||||||
serverErrors = [],
|
const serverErrors = [];
|
||||||
clientErrors = [],
|
const clientErrors = [];
|
||||||
serverError,
|
let serverError;
|
||||||
clientError;
|
let clientError;
|
||||||
|
|
||||||
var server = tls.createServer(serverOptions, function(c) {
|
var server = tls.createServer(serverOptions, function(c) {
|
||||||
serverResults.push({ sni: c.servername, authorized: c.authorized });
|
serverResults.push({ sni: c.servername, authorized: c.authorized });
|
||||||
|
@ -5,9 +5,9 @@ if (!process.features.tls_sni) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
assert = require('assert'),
|
const assert = require('assert');
|
||||||
fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
console.log('1..0 # Skipped: missing crypto');
|
console.log('1..0 # Skipped: missing crypto');
|
||||||
@ -73,8 +73,8 @@ var clientsOptions = [{
|
|||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var serverResults = [],
|
const serverResults = [];
|
||||||
clientResults = [];
|
const clientResults = [];
|
||||||
|
|
||||||
var server = tls.createServer(serverOptions, function(c) {
|
var server = tls.createServer(serverOptions, function(c) {
|
||||||
serverResults.push(c.servername);
|
serverResults.push(c.servername);
|
||||||
|
@ -260,19 +260,19 @@ var parseTests = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=':
|
'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=':
|
||||||
{
|
{
|
||||||
'href': 'http://user:pass@mt0.google.com/vt/lyrs=m@114???' +
|
'href': 'http://user:pass@mt0.google.com/vt/lyrs=m@114???' +
|
||||||
'&hl=en&src=api&x=2&y=2&z=3&s=',
|
'&hl=en&src=api&x=2&y=2&z=3&s=',
|
||||||
'protocol': 'http:',
|
'protocol': 'http:',
|
||||||
'slashes': true,
|
'slashes': true,
|
||||||
'host': 'mt0.google.com',
|
'host': 'mt0.google.com',
|
||||||
'auth': 'user:pass',
|
'auth': 'user:pass',
|
||||||
'hostname': 'mt0.google.com',
|
'hostname': 'mt0.google.com',
|
||||||
'search': '???&hl=en&src=api&x=2&y=2&z=3&s=',
|
'search': '???&hl=en&src=api&x=2&y=2&z=3&s=',
|
||||||
'query': '??&hl=en&src=api&x=2&y=2&z=3&s=',
|
'query': '??&hl=en&src=api&x=2&y=2&z=3&s=',
|
||||||
'pathname': '/vt/lyrs=m@114',
|
'pathname': '/vt/lyrs=m@114',
|
||||||
'path': '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
|
'path': '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
|
||||||
},
|
},
|
||||||
|
|
||||||
'file:///etc/passwd' : {
|
'file:///etc/passwd' : {
|
||||||
'href': 'file:///etc/passwd',
|
'href': 'file:///etc/passwd',
|
||||||
@ -870,8 +870,8 @@ for (var u in parseTests) {
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
assert.deepEqual(spaced, expected);
|
assert.deepEqual(spaced, expected);
|
||||||
|
|
||||||
var expected = parseTests[u].href,
|
expected = parseTests[u].href;
|
||||||
actual = url.format(parseTests[u]);
|
actual = url.format(parseTests[u]);
|
||||||
|
|
||||||
assert.equal(actual, expected,
|
assert.equal(actual, expected,
|
||||||
'format(' + u + ') == ' + u + '\nactual:' + actual);
|
'format(' + u + ') == ' + u + '\nactual:' + actual);
|
||||||
@ -1194,8 +1194,8 @@ var relativeTests = [
|
|||||||
['http://localhost', 'file://foo/Users', 'file://foo/Users']
|
['http://localhost', 'file://foo/Users', 'file://foo/Users']
|
||||||
];
|
];
|
||||||
relativeTests.forEach(function(relativeTest) {
|
relativeTests.forEach(function(relativeTest) {
|
||||||
var a = url.resolve(relativeTest[0], relativeTest[1]),
|
const a = url.resolve(relativeTest[0], relativeTest[1]);
|
||||||
e = relativeTest[2];
|
const e = relativeTest[2];
|
||||||
assert.equal(a, e,
|
assert.equal(a, e,
|
||||||
'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e +
|
'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e +
|
||||||
'\n actual=' + a);
|
'\n actual=' + a);
|
||||||
@ -1504,8 +1504,8 @@ var relativeTests2 = [
|
|||||||
'http://diff:auth@www.example.com/']
|
'http://diff:auth@www.example.com/']
|
||||||
];
|
];
|
||||||
relativeTests2.forEach(function(relativeTest) {
|
relativeTests2.forEach(function(relativeTest) {
|
||||||
var a = url.resolve(relativeTest[1], relativeTest[0]),
|
const a = url.resolve(relativeTest[1], relativeTest[0]);
|
||||||
e = relativeTest[2];
|
const e = relativeTest[2];
|
||||||
assert.equal(a, e,
|
assert.equal(a, e,
|
||||||
'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e +
|
'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e +
|
||||||
'\n actual=' + a);
|
'\n actual=' + a);
|
||||||
@ -1516,8 +1516,8 @@ relativeTests2.forEach(function(relativeTest) {
|
|||||||
|
|
||||||
//format: [from, path, expected]
|
//format: [from, path, expected]
|
||||||
relativeTests.forEach(function(relativeTest) {
|
relativeTests.forEach(function(relativeTest) {
|
||||||
var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]),
|
var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]);
|
||||||
expected = url.parse(relativeTest[2]);
|
var expected = url.parse(relativeTest[2]);
|
||||||
|
|
||||||
|
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
@ -1544,13 +1544,13 @@ if (relativeTests2[181][0] === './/g' &&
|
|||||||
relativeTests2.splice(181, 1);
|
relativeTests2.splice(181, 1);
|
||||||
}
|
}
|
||||||
relativeTests2.forEach(function(relativeTest) {
|
relativeTests2.forEach(function(relativeTest) {
|
||||||
var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]),
|
var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]);
|
||||||
expected = url.parse(relativeTest[2]);
|
var expected = url.parse(relativeTest[2]);
|
||||||
|
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
|
|
||||||
var expected = relativeTest[2],
|
expected = relativeTest[2];
|
||||||
actual = url.format(actual);
|
actual = url.format(actual);
|
||||||
|
|
||||||
assert.equal(actual, expected,
|
assert.equal(actual, expected,
|
||||||
'format(' + relativeTest[1] + ') == ' + expected +
|
'format(' + relativeTest[1] + ') == ' + expected +
|
||||||
|
@ -28,9 +28,9 @@ var tests = [
|
|||||||
// test util.log()
|
// test util.log()
|
||||||
tests.forEach(function(test) {
|
tests.forEach(function(test) {
|
||||||
util.log(test.input);
|
util.log(test.input);
|
||||||
var result = strings.shift().trim(),
|
const result = strings.shift().trim();
|
||||||
re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/),
|
const re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/);
|
||||||
match = re.exec(result);
|
const match = re.exec(result);
|
||||||
assert.ok(match);
|
assert.ok(match);
|
||||||
assert.equal(match[1], test.output);
|
assert.equal(match[1], test.output);
|
||||||
});
|
});
|
||||||
|
@ -5,18 +5,18 @@ var zlib = require('zlib');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg')),
|
const file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg'));
|
||||||
chunkSize = 16,
|
const chunkSize = 16;
|
||||||
opts = { level: 0 },
|
const opts = { level: 0 };
|
||||||
deflater = zlib.createDeflate(opts);
|
const deflater = zlib.createDeflate(opts);
|
||||||
|
|
||||||
var chunk = file.slice(0, chunkSize),
|
const chunk = file.slice(0, chunkSize);
|
||||||
expectedNone = new Buffer([0x78, 0x01]),
|
const expectedNone = new Buffer([0x78, 0x01]);
|
||||||
blkhdr = new Buffer([0x00, 0x10, 0x00, 0xef, 0xff]),
|
const blkhdr = new Buffer([0x00, 0x10, 0x00, 0xef, 0xff]);
|
||||||
adler32 = new Buffer([0x00, 0x00, 0x00, 0xff, 0xff]),
|
const adler32 = new Buffer([0x00, 0x00, 0x00, 0xff, 0xff]);
|
||||||
expectedFull = Buffer.concat([blkhdr, chunk, adler32]),
|
const expectedFull = Buffer.concat([blkhdr, chunk, adler32]);
|
||||||
actualNone,
|
let actualNone;
|
||||||
actualFull;
|
let actualFull;
|
||||||
|
|
||||||
deflater.write(chunk, function() {
|
deflater.write(chunk, function() {
|
||||||
deflater.flush(zlib.Z_NO_FLUSH, function() {
|
deflater.flush(zlib.Z_NO_FLUSH, function() {
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
// test uncompressing invalid input
|
// test uncompressing invalid input
|
||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
|
|
||||||
var nonStringInputs = [1, true, {a: 1}, ['a']];
|
var nonStringInputs = [1, true, {a: 1}, ['a']];
|
||||||
|
|
||||||
|
@ -5,16 +5,16 @@ var zlib = require('zlib');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg')),
|
const file = fs.readFileSync(path.resolve(common.fixturesDir, 'person.jpg'));
|
||||||
chunkSize = 24 * 1024,
|
const chunkSize = 24 * 1024;
|
||||||
opts = { level: 9, strategy: zlib.Z_DEFAULT_STRATEGY },
|
const opts = { level: 9, strategy: zlib.Z_DEFAULT_STRATEGY };
|
||||||
deflater = zlib.createDeflate(opts);
|
const deflater = zlib.createDeflate(opts);
|
||||||
|
|
||||||
var chunk1 = file.slice(0, chunkSize),
|
const chunk1 = file.slice(0, chunkSize);
|
||||||
chunk2 = file.slice(chunkSize),
|
const chunk2 = file.slice(chunkSize);
|
||||||
blkhdr = new Buffer([0x00, 0x48, 0x82, 0xb7, 0x7d]),
|
const blkhdr = new Buffer([0x00, 0x48, 0x82, 0xb7, 0x7d]);
|
||||||
expected = Buffer.concat([blkhdr, chunk2]),
|
const expected = Buffer.concat([blkhdr, chunk2]);
|
||||||
actual;
|
let actual;
|
||||||
|
|
||||||
deflater.write(chunk1, function() {
|
deflater.write(chunk1, function() {
|
||||||
deflater.params(0, zlib.Z_DEFAULT_STRATEGY, function() {
|
deflater.params(0, zlib.Z_DEFAULT_STRATEGY, function() {
|
||||||
|
@ -11,8 +11,8 @@ var crypto = require('crypto');
|
|||||||
var p = crypto.createDiffieHellman(1024).getPrime();
|
var p = crypto.createDiffieHellman(1024).getPrime();
|
||||||
|
|
||||||
for (var i = 0; i < 2000; i++) {
|
for (var i = 0; i < 2000; i++) {
|
||||||
var a = crypto.createDiffieHellman(p),
|
const a = crypto.createDiffieHellman(p);
|
||||||
b = crypto.createDiffieHellman(p);
|
const b = crypto.createDiffieHellman(p);
|
||||||
|
|
||||||
a.generateKeys();
|
a.generateKeys();
|
||||||
b.generateKeys();
|
b.generateKeys();
|
||||||
|
@ -17,19 +17,21 @@ var success_count = 0;
|
|||||||
var error_count = 0;
|
var error_count = 0;
|
||||||
|
|
||||||
|
|
||||||
exec('"' + process.execPath + '" -p -e process.versions',
|
exec(
|
||||||
function(err, stdout, stderr) {
|
'"' + process.execPath + '" -p -e process.versions',
|
||||||
if (err) {
|
function(err, stdout, stderr) {
|
||||||
error_count++;
|
if (err) {
|
||||||
console.log('error!: ' + err.code);
|
error_count++;
|
||||||
console.log('stdout: ' + JSON.stringify(stdout));
|
console.log('error!: ' + err.code);
|
||||||
console.log('stderr: ' + JSON.stringify(stderr));
|
console.log('stdout: ' + JSON.stringify(stdout));
|
||||||
assert.equal(false, err.killed);
|
console.log('stderr: ' + JSON.stringify(stderr));
|
||||||
} else {
|
assert.equal(false, err.killed);
|
||||||
success_count++;
|
} else {
|
||||||
console.dir(stdout);
|
success_count++;
|
||||||
|
console.dir(stdout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
|
|
||||||
exec('thisisnotavalidcommand', function(err, stdout, stderr) {
|
exec('thisisnotavalidcommand', function(err, stdout, stderr) {
|
||||||
|
@ -19,19 +19,19 @@ catch (e) {
|
|||||||
fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) {
|
fs.watchFile(FILENAME, {interval:TIMEOUT - 250}, function(curr, prev) {
|
||||||
console.log([curr, prev]);
|
console.log([curr, prev]);
|
||||||
switch (++nevents) {
|
switch (++nevents) {
|
||||||
case 1:
|
case 1:
|
||||||
assert.equal(common.fileExists(FILENAME), false);
|
assert.equal(common.fileExists(FILENAME), false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
assert.equal(common.fileExists(FILENAME), true);
|
assert.equal(common.fileExists(FILENAME), true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
assert.equal(common.fileExists(FILENAME), false);
|
assert.equal(common.fileExists(FILENAME), false);
|
||||||
fs.unwatchFile(FILENAME);
|
fs.unwatchFile(FILENAME);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const net = require('net');
|
||||||
var net = require('net'),
|
const http = require('http');
|
||||||
http = require('http');
|
|
||||||
|
|
||||||
var errorCount = 0;
|
var errorCount = 0;
|
||||||
var eofCount = 0;
|
var eofCount = 0;
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
// This tests setTimeout() by having multiple clients connecting and sending
|
// This tests setTimeout() by having multiple clients connecting and sending
|
||||||
// data in random intervals. Clients are also randomly disconnecting until there
|
// data in random intervals. Clients are also randomly disconnecting until there
|
||||||
// are no more clients left. If no false timeout occurs, this test has passed.
|
// are no more clients left. If no false timeout occurs, this test has passed.
|
||||||
var common = require('../common'),
|
const common = require('../common');
|
||||||
http = require('http'),
|
const http = require('http');
|
||||||
server = http.createServer(),
|
const server = http.createServer();
|
||||||
connections = 0;
|
let connections = 0;
|
||||||
|
|
||||||
server.on('request', function(req, res) {
|
server.on('request', function(req, res) {
|
||||||
req.socket.setTimeout(1000);
|
req.socket.setTimeout(1000);
|
||||||
|
@ -12,8 +12,7 @@ var start = Date.now();
|
|||||||
var err;
|
var err;
|
||||||
var caught = false;
|
var caught = false;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
|
var cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`;
|
||||||
var ret = execSync(cmd, {timeout: TIMER});
|
var ret = execSync(cmd, {timeout: TIMER});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -34,8 +34,8 @@ function pingPongTest(port, host) {
|
|||||||
server.on('listening', function() {
|
server.on('listening', function() {
|
||||||
console.log('server listening on ' + port + ' ' + host);
|
console.log('server listening on ' + port + ' ' + host);
|
||||||
|
|
||||||
var buf = new Buffer('PING'),
|
const buf = new Buffer('PING');
|
||||||
client = dgram.createSocket('udp4');
|
const client = dgram.createSocket('udp4');
|
||||||
|
|
||||||
client.on('message', function(msg, rinfo) {
|
client.on('message', function(msg, rinfo) {
|
||||||
if (debug) console.log('client got: ' + msg +
|
if (debug) console.log('client got: ' + msg +
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
(function() {
|
(function() {
|
||||||
var assert = require('assert'),
|
const assert = require('assert');
|
||||||
child = require('child_process'),
|
const child = require('child_process');
|
||||||
util = require('util'),
|
const util = require('util');
|
||||||
common = require('../common');
|
const common = require('../common');
|
||||||
if (process.env['TEST_INIT']) {
|
if (process.env['TEST_INIT']) {
|
||||||
util.print('Loaded successfully!');
|
util.print('Loaded successfully!');
|
||||||
} else {
|
} else {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user