Skip to content

Commit

Permalink
test: remove unused vars from parallel tests
Browse files Browse the repository at this point in the history
Remove all remaining unused variables from tests in test/parallel.

PR-URL: nodejs#4511
Reviewed-By: James M Snell<jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
Trott committed Jan 4, 2016
1 parent 063c9f6 commit c14726c
Show file tree
Hide file tree
Showing 38 changed files with 14 additions and 76 deletions.
1 change: 0 additions & 1 deletion test/parallel/test-buffer-fakes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require('../common');
const assert = require('assert');
const Buffer = require('buffer').Buffer;
const Bp = Buffer.prototype;

function FakeBuffer() { }
FakeBuffer.__proto__ = Buffer;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-exec-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-http-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-crypto-binary-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-debug-signal-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-dgram-error-message-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dgram-pingpong.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down Expand Up @@ -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();
});
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-domain-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-domain-implicit-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-domain-uncaught-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const assert = require('assert');
const domain = require('domain');
const child_process = require('child_process');

const uncaughtExceptions = {};

const tests = [];

function test1() {
Expand Down
11 changes: 0 additions & 11 deletions test/parallel/test-domain-with-abort-on-uncaught-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dsa-fips-invalid-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions test/parallel/test-event-emitter-remove-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ function listener2() {
count++;
}

function listener3() {
console.log('listener3');
count++;
}

function remove1() {
assert(0);
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-file-write-stream3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -167,7 +167,7 @@ function run_test_3() {


function run_test_4() {
var file, options;
var options;

options = { start: -5,
flags: 'r+' };
Expand Down
5 changes: 0 additions & 5 deletions test/parallel/test-fs-open-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-open.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var constants = require('constants');
var assert = require('assert');
var fs = require('fs');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-read-buffer-tostring-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-write-file-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down
5 changes: 2 additions & 3 deletions test/parallel/test-promises-unhandled-rejections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' +
Expand Down Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-readline-undefined-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-regress-GH-4256.js
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion test/parallel/test-repl-autolibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-syntax-error-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-stream-pipe-error-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var Stream = require('stream').Stream;
})();

(function testErrorWithRemovedListenerThrows() {
var EE = require('events').EventEmitter;
var R = Stream.Readable;
var W = Stream.Writable;

Expand Down Expand Up @@ -73,7 +72,6 @@ var Stream = require('stream').Stream;
})();

(function testErrorWithRemovedListenerThrows() {
var EE = require('events').EventEmitter;
var R = Stream.Readable;
var W = Stream.Writable;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream-push-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ s._read = function(n) {
}
};

var v = s.read(0);
s.read(0);

// ACTUALLY [1, 3, 5, 6, 4, 2]

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-stream-unshift-read-race.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-stream-writev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-stream2-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-stream2-large-read-stall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-stream2-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
4 changes: 0 additions & 4 deletions test/parallel/test-stream2-readable-from-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -69,8 +67,6 @@ test('buffers', function(t) {
});

test('strings', function(t) {
// have a length
var len = 16;
var list = [ 'foog',
'bark',
'bazy',
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-stream2-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-timers-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit c14726c

Please sign in to comment.