test: remove unused vars from parallel tests
Remove all remaining unused variables from tests in test/parallel. PR-URL: https://github.com/nodejs/node/pull/4511 Reviewed-By: James M Snell<jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit is contained in:
parent
063c9f6886
commit
c14726cefc
@ -3,7 +3,6 @@
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
const Bp = Buffer.prototype;
|
||||
|
||||
function FakeBuffer() { }
|
||||
FakeBuffer.__proto__ = Buffer;
|
||||
|
@ -18,7 +18,7 @@ exec('echo ' + str, function(err, stdout, stderr) {
|
||||
});
|
||||
|
||||
// no encoding (Buffers expected)
|
||||
var child = exec('echo ' + str, {
|
||||
exec('echo ' + str, {
|
||||
encoding: null
|
||||
}, function(err, stdout, stderr) {
|
||||
assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer');
|
||||
|
@ -34,7 +34,6 @@ http.createServer(function(req, res) {
|
||||
res.writeHead(200);
|
||||
res.end('OK');
|
||||
}).listen(common.PIPE, function() {
|
||||
var self = this;
|
||||
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
|
||||
res.resume();
|
||||
res.on('end', function(err) {
|
||||
|
@ -20,7 +20,6 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
// Test Certificates
|
||||
var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
|
||||
var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
|
||||
var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
|
||||
var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
|
||||
|
@ -10,7 +10,6 @@ var options = { stdio: ['inherit', 'inherit', 'pipe', 'ipc'] };
|
||||
var child = spawn(process.execPath, args, options);
|
||||
|
||||
var outputLines = [];
|
||||
var outputTimerId;
|
||||
var waitingForDebuggers = false;
|
||||
|
||||
var pids = null;
|
||||
|
@ -20,7 +20,6 @@ socket_ipv4.bind(common.PORT, '1.1.1.1');
|
||||
|
||||
// IPv6 Test
|
||||
var socket_ipv6 = dgram.createSocket('udp6');
|
||||
var family_ipv6 = 'IPv6';
|
||||
|
||||
socket_ipv6.on('listening', common.fail);
|
||||
|
||||
|
@ -11,7 +11,6 @@ function pingPongTest(port, host) {
|
||||
var callbacks = 0;
|
||||
var N = 500;
|
||||
var count = 0;
|
||||
var sent_final_ping = false;
|
||||
|
||||
var server = dgram.createSocket('udp4', function(msg, rinfo) {
|
||||
if (debug) console.log('server got: ' + msg +
|
||||
@ -48,7 +47,6 @@ function pingPongTest(port, host) {
|
||||
if (count < N) {
|
||||
client.send(buf, 0, buf.length, port, 'localhost');
|
||||
} else {
|
||||
sent_final_ping = true;
|
||||
client.send(buf, 0, buf.length, port, 'localhost', function() {
|
||||
client.close();
|
||||
});
|
||||
|
@ -9,7 +9,6 @@ objects.baz.asdf = objects;
|
||||
|
||||
var serverCaught = 0;
|
||||
var clientCaught = 0;
|
||||
var disposeEmit = 0;
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
var dom = domain.create();
|
||||
|
@ -9,7 +9,6 @@ var caught = 0;
|
||||
var expectCaught = 1;
|
||||
|
||||
var d = new domain.Domain();
|
||||
var e = new events.EventEmitter();
|
||||
|
||||
d.on('error', function(er) {
|
||||
console.error('caught', er);
|
||||
|
@ -13,8 +13,6 @@ const assert = require('assert');
|
||||
const domain = require('domain');
|
||||
const child_process = require('child_process');
|
||||
|
||||
const uncaughtExceptions = {};
|
||||
|
||||
const tests = [];
|
||||
|
||||
function test1() {
|
||||
|
@ -31,7 +31,6 @@ const domainErrHandlerExMessage = 'exception from domain error handler';
|
||||
if (process.argv[2] === 'child') {
|
||||
var domain = require('domain');
|
||||
var d = domain.create();
|
||||
var triggeredProcessUncaughtException = false;
|
||||
|
||||
process.on('uncaughtException', function onUncaughtException() {
|
||||
// The process' uncaughtException event must not be emitted when
|
||||
@ -116,17 +115,7 @@ if (process.argv[2] === 'child') {
|
||||
var child = exec(cmdToExec);
|
||||
|
||||
if (child) {
|
||||
var childTriggeredOnUncaughtExceptionHandler = false;
|
||||
child.on('message', function onChildMsg(msg) {
|
||||
if (msg === 'triggeredProcessUncaughtEx') {
|
||||
childTriggeredOnUncaughtExceptionHandler = true;
|
||||
}
|
||||
});
|
||||
|
||||
child.on('exit', function onChildExited(exitCode, signal) {
|
||||
var expectedExitCodes;
|
||||
var expectedSignals;
|
||||
|
||||
// When throwing errors from the top-level domain error handler
|
||||
// outside of a try/catch block, the process should not exit gracefully
|
||||
if (!options.useTryCatch && options.throwInDomainErrHandler) {
|
||||
|
@ -12,8 +12,6 @@ var fs = require('fs');
|
||||
|
||||
var input = 'hello';
|
||||
|
||||
var dsapub = fs.readFileSync(common.fixturesDir +
|
||||
'/keys/dsa_public_1025.pem');
|
||||
var dsapri = fs.readFileSync(common.fixturesDir +
|
||||
'/keys/dsa_private_1025.pem');
|
||||
var sign = crypto.createSign('DSS1');
|
||||
|
@ -10,7 +10,7 @@ var error_count = 0;
|
||||
var cmd = ['"' + process.execPath + '"', '-e', '"console.error(process.argv)"',
|
||||
'foo', 'bar'].join(' ');
|
||||
var expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
|
||||
var child = exec(cmd, function(err, stdout, stderr) {
|
||||
exec(cmd, function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.log(err.toString());
|
||||
++error_count;
|
||||
|
@ -15,11 +15,6 @@ function listener2() {
|
||||
count++;
|
||||
}
|
||||
|
||||
function listener3() {
|
||||
console.log('listener3');
|
||||
count++;
|
||||
}
|
||||
|
||||
function remove1() {
|
||||
assert(0);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ function run_test_2() {
|
||||
|
||||
|
||||
function run_test_3() {
|
||||
var file, buffer, options;
|
||||
var file, options;
|
||||
|
||||
var data = '\u2026\u2026', // 3 bytes * 2 = 6 bytes in UTF-8
|
||||
fileData;
|
||||
@ -167,7 +167,7 @@ function run_test_3() {
|
||||
|
||||
|
||||
function run_test_4() {
|
||||
var file, options;
|
||||
var options;
|
||||
|
||||
options = { start: -5,
|
||||
flags: 'r+' };
|
||||
|
@ -7,14 +7,9 @@ var fs = require('fs');
|
||||
|
||||
var O_APPEND = constants.O_APPEND || 0;
|
||||
var O_CREAT = constants.O_CREAT || 0;
|
||||
var O_DIRECTORY = constants.O_DIRECTORY || 0;
|
||||
var O_EXCL = constants.O_EXCL || 0;
|
||||
var O_NOCTTY = constants.O_NOCTTY || 0;
|
||||
var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
|
||||
var O_RDONLY = constants.O_RDONLY || 0;
|
||||
var O_RDWR = constants.O_RDWR || 0;
|
||||
var O_SYMLINK = constants.O_SYMLINK || 0;
|
||||
var O_SYNC = constants.O_SYNC || 0;
|
||||
var O_TRUNC = constants.O_TRUNC || 0;
|
||||
var O_WRONLY = constants.O_WRONLY || 0;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
var constants = require('constants');
|
||||
var assert = require('assert');
|
||||
var fs = require('fs');
|
||||
|
||||
|
@ -6,7 +6,6 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
const kStringMaxLength = process.binding('buffer').kStringMaxLength;
|
||||
const kMaxLength = process.binding('buffer').kMaxLength;
|
||||
|
||||
var fd;
|
||||
|
||||
|
@ -48,7 +48,7 @@ function expect_ok(syscall, resource, err, atime, mtime) {
|
||||
// would be even better though (node doesn't have such functionality yet)
|
||||
function runTest(atime, mtime, callback) {
|
||||
|
||||
var fd, err;
|
||||
var fd;
|
||||
//
|
||||
// test synchronized code paths, these functions throw on failure
|
||||
//
|
||||
|
@ -15,7 +15,7 @@ fs._closeSync = fs.closeSync;
|
||||
fs.closeSync = closeSync;
|
||||
|
||||
// Reset the umask for testing
|
||||
var mask = process.umask(0o000);
|
||||
process.umask(0o000);
|
||||
|
||||
// On Windows chmod is only able to manipulate read-only bit. Test if creating
|
||||
// the file in read-only mode works.
|
||||
|
@ -82,7 +82,6 @@ child_process.exec(nodeBinary + ' '
|
||||
});
|
||||
|
||||
// https://github.com/nodejs/node/issues/1691
|
||||
var originalCwd = process.cwd();
|
||||
process.chdir(path.join(__dirname, '../fixtures/'));
|
||||
child_process.exec(nodeBinary + ' '
|
||||
+ '--expose_debug_as=v8debug '
|
||||
|
@ -185,12 +185,11 @@ asyncTest('When re-throwing new errors in a promise catch, only the' +
|
||||
asyncTest('Test params of unhandledRejection for a synchronously-rejected' +
|
||||
'promise', function(done) {
|
||||
var e = new Error();
|
||||
var e2 = new Error();
|
||||
onUnhandledSucceed(done, function(reason, promise) {
|
||||
assert.strictEqual(e, reason);
|
||||
assert.strictEqual(promise, promise);
|
||||
});
|
||||
var promise = Promise.reject(e);
|
||||
Promise.reject(e);
|
||||
});
|
||||
|
||||
asyncTest('When re-throwing new errors in a promise catch, only the ' +
|
||||
@ -629,7 +628,7 @@ asyncTest('Promise unhandledRejection handler does not interfere with domain' +
|
||||
assert.strictEqual(domainReceivedError, domainError);
|
||||
d.dispose();
|
||||
});
|
||||
var a = Promise.reject(e);
|
||||
Promise.reject(e);
|
||||
process.nextTick(function() {
|
||||
throw domainError;
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ const readline = require('readline');
|
||||
const iStream = new PassThrough();
|
||||
const oStream = new PassThrough();
|
||||
|
||||
const rli = readline.createInterface({
|
||||
readline.createInterface({
|
||||
terminal: true,
|
||||
input: iStream,
|
||||
output: oStream,
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
process.domain = null;
|
||||
var timer = setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
console.log('this console.log statement should not make node crash');
|
||||
}, 1);
|
||||
|
@ -8,7 +8,7 @@ var repl = require('repl');
|
||||
common.globalCheck = false;
|
||||
|
||||
const putIn = new common.ArrayStream();
|
||||
var testMe = repl.start('', putIn, null, true);
|
||||
repl.start('', putIn, null, true);
|
||||
|
||||
test1();
|
||||
|
||||
|
@ -16,7 +16,7 @@ common.ArrayStream.prototype.write = function(output) {
|
||||
};
|
||||
|
||||
const putIn = new common.ArrayStream();
|
||||
const testMe = repl.start('', putIn);
|
||||
repl.start('', putIn);
|
||||
let file = path.resolve(__dirname, '../fixtures/syntax/bad_syntax');
|
||||
|
||||
if (common.isWindows)
|
||||
|
@ -38,7 +38,6 @@ var Stream = require('stream').Stream;
|
||||
})();
|
||||
|
||||
(function testErrorWithRemovedListenerThrows() {
|
||||
var EE = require('events').EventEmitter;
|
||||
var R = Stream.Readable;
|
||||
var W = Stream.Writable;
|
||||
|
||||
@ -73,7 +72,6 @@ var Stream = require('stream').Stream;
|
||||
})();
|
||||
|
||||
(function testErrorWithRemovedListenerThrows() {
|
||||
var EE = require('events').EventEmitter;
|
||||
var R = Stream.Readable;
|
||||
var W = Stream.Writable;
|
||||
|
||||
|
@ -21,7 +21,7 @@ s._read = function(n) {
|
||||
}
|
||||
};
|
||||
|
||||
var v = s.read(0);
|
||||
s.read(0);
|
||||
|
||||
// ACTUALLY [1, 3, 5, 6, 4, 2]
|
||||
|
||||
|
@ -13,7 +13,6 @@ var stream = require('stream');
|
||||
var hwm = 10;
|
||||
var r = stream.Readable({ highWaterMark: hwm });
|
||||
var chunks = 10;
|
||||
var t = (chunks * 5);
|
||||
|
||||
var data = new Buffer(chunks * hwm + Math.ceil(hwm / 2));
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
|
@ -30,11 +30,9 @@ function test(decode, uncork, multi, next) {
|
||||
function cnt(msg) {
|
||||
expectCount++;
|
||||
var expect = expectCount;
|
||||
var called = false;
|
||||
return function(er) {
|
||||
if (er)
|
||||
throw er;
|
||||
called = true;
|
||||
counter++;
|
||||
assert.equal(counter, expect);
|
||||
};
|
||||
|
@ -5,7 +5,6 @@ var W = require('_stream_writable');
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
var EE = require('events').EventEmitter;
|
||||
|
||||
var ondataCalled = 0;
|
||||
|
||||
|
@ -53,9 +53,6 @@ function push() {
|
||||
setTimeout(push);
|
||||
}
|
||||
|
||||
// start the flow
|
||||
var ret = r.read(0);
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(pushes, PUSHCOUNT + 1);
|
||||
assert(endEmitted);
|
||||
|
@ -167,8 +167,6 @@ test('read(0) for object streams', function(t) {
|
||||
r.push('foobar');
|
||||
r.push(null);
|
||||
|
||||
var v = r.read(0);
|
||||
|
||||
r.pipe(toArray(function(array) {
|
||||
assert.deepEqual(array, ['foobar']);
|
||||
|
||||
|
@ -39,8 +39,6 @@ process.nextTick(run);
|
||||
|
||||
|
||||
test('buffers', function(t) {
|
||||
// have a length
|
||||
var len = 16;
|
||||
var list = [ new Buffer('foog'),
|
||||
new Buffer('bark'),
|
||||
new Buffer('bazy'),
|
||||
@ -69,8 +67,6 @@ test('buffers', function(t) {
|
||||
});
|
||||
|
||||
test('strings', function(t) {
|
||||
// have a length
|
||||
var len = 16;
|
||||
var list = [ 'foog',
|
||||
'bark',
|
||||
'bazy',
|
||||
|
@ -303,13 +303,10 @@ test('passthrough event emission', function(t) {
|
||||
var pt = new PassThrough();
|
||||
var emits = 0;
|
||||
pt.on('readable', function() {
|
||||
var state = pt._readableState;
|
||||
console.error('>>> emit readable %d', emits);
|
||||
emits++;
|
||||
});
|
||||
|
||||
var i = 0;
|
||||
|
||||
pt.write(new Buffer('foog'));
|
||||
|
||||
console.error('need emit 0');
|
||||
|
@ -3,13 +3,10 @@ require('../common');
|
||||
var assert = require('assert');
|
||||
var Timer = process.binding('timer_wrap').Timer;
|
||||
|
||||
var i;
|
||||
|
||||
var N = 30;
|
||||
|
||||
var last_i = 0;
|
||||
var last_ts = 0;
|
||||
var start = Timer.now();
|
||||
|
||||
var f = function(i) {
|
||||
if (i <= N) {
|
||||
|
@ -7,7 +7,7 @@ var assert = require('assert');
|
||||
var ncalled = 0;
|
||||
|
||||
setTimeout(f, 0, 'foo', 'bar', 'baz');
|
||||
var timer = setTimeout(function() {}, 0);
|
||||
setTimeout(function() {}, 0);
|
||||
|
||||
function f(a, b, c) {
|
||||
assert.equal(a, 'foo');
|
||||
|
@ -1514,9 +1514,6 @@ relativeTests2.forEach(function(relativeTest) {
|
||||
//if format and parse are inverse operations then
|
||||
//resolveObject(parse(x), y) == parse(resolve(x, y))
|
||||
|
||||
//host and hostname are special, in this case a '' value is important
|
||||
var emptyIsImportant = {'host': true, 'hostname': ''};
|
||||
|
||||
//format: [from, path, expected]
|
||||
relativeTests.forEach(function(relativeTest) {
|
||||
var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user