Browse Source

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>
v5.x
Rich Trott 9 years ago
committed by Jeremiah Senkpiel
parent
commit
ae0246641c
  1. 1
      test/parallel/test-buffer-fakes.js
  2. 2
      test/parallel/test-child-process-exec-buffer.js
  3. 1
      test/parallel/test-cluster-http-pipe.js
  4. 1
      test/parallel/test-crypto-binary-default.js
  5. 1
      test/parallel/test-debug-signal-cluster.js
  6. 1
      test/parallel/test-dgram-error-message-address.js
  7. 2
      test/parallel/test-dgram-pingpong.js
  8. 1
      test/parallel/test-domain-http-server.js
  9. 1
      test/parallel/test-domain-implicit-fs.js
  10. 2
      test/parallel/test-domain-uncaught-exception.js
  11. 11
      test/parallel/test-domain-with-abort-on-uncaught-exception.js
  12. 2
      test/parallel/test-dsa-fips-invalid-key.js
  13. 2
      test/parallel/test-eval.js
  14. 5
      test/parallel/test-event-emitter-remove-listeners.js
  15. 4
      test/parallel/test-file-write-stream3.js
  16. 5
      test/parallel/test-fs-open-flags.js
  17. 1
      test/parallel/test-fs-open.js
  18. 1
      test/parallel/test-fs-read-buffer-tostring-fail.js
  19. 2
      test/parallel/test-fs-utimes.js
  20. 2
      test/parallel/test-fs-write-file-sync.js
  21. 1
      test/parallel/test-preload.js
  22. 5
      test/parallel/test-promises-unhandled-rejections.js
  23. 2
      test/parallel/test-readline-undefined-columns.js
  24. 2
      test/parallel/test-regress-GH-4256.js
  25. 2
      test/parallel/test-repl-autolibs.js
  26. 2
      test/parallel/test-repl-syntax-error-stack.js
  27. 2
      test/parallel/test-stream-pipe-error-handling.js
  28. 2
      test/parallel/test-stream-push-order.js
  29. 1
      test/parallel/test-stream-unshift-read-race.js
  30. 2
      test/parallel/test-stream-writev.js
  31. 1
      test/parallel/test-stream2-compatibility.js
  32. 3
      test/parallel/test-stream2-large-read-stall.js
  33. 2
      test/parallel/test-stream2-objects.js
  34. 4
      test/parallel/test-stream2-readable-from-list.js
  35. 3
      test/parallel/test-stream2-transform.js
  36. 3
      test/parallel/test-timers-ordering.js
  37. 2
      test/parallel/test-timers-zero-timeout.js
  38. 3
      test/parallel/test-url.js

1
test/parallel/test-buffer-fakes.js

@ -3,7 +3,6 @@
require('../common'); require('../common');
const assert = require('assert'); const assert = require('assert');
const Buffer = require('buffer').Buffer; const Buffer = require('buffer').Buffer;
const Bp = Buffer.prototype;
function FakeBuffer() { } function FakeBuffer() { }
FakeBuffer.__proto__ = Buffer; FakeBuffer.__proto__ = Buffer;

2
test/parallel/test-child-process-exec-buffer.js

@ -18,7 +18,7 @@ exec('echo ' + str, function(err, stdout, stderr) {
}); });
// no encoding (Buffers expected) // no encoding (Buffers expected)
var child = exec('echo ' + str, { exec('echo ' + str, {
encoding: null encoding: null
}, function(err, stdout, stderr) { }, function(err, stdout, stderr) {
assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer'); assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer');

1
test/parallel/test-cluster-http-pipe.js

@ -34,7 +34,6 @@ http.createServer(function(req, res) {
res.writeHead(200); res.writeHead(200);
res.end('OK'); res.end('OK');
}).listen(common.PIPE, function() { }).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) { http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
res.resume(); res.resume();
res.on('end', function(err) { res.on('end', function(err) {

1
test/parallel/test-crypto-binary-default.js

@ -20,7 +20,6 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
// Test Certificates // Test Certificates
var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');

1
test/parallel/test-debug-signal-cluster.js

@ -10,7 +10,6 @@ var options = { stdio: ['inherit', 'inherit', 'pipe', 'ipc'] };
var child = spawn(process.execPath, args, options); var child = spawn(process.execPath, args, options);
var outputLines = []; var outputLines = [];
var outputTimerId;
var waitingForDebuggers = false; var waitingForDebuggers = false;
var pids = null; var pids = null;

1
test/parallel/test-dgram-error-message-address.js

@ -20,7 +20,6 @@ socket_ipv4.bind(common.PORT, '1.1.1.1');
// IPv6 Test // IPv6 Test
var socket_ipv6 = dgram.createSocket('udp6'); var socket_ipv6 = dgram.createSocket('udp6');
var family_ipv6 = 'IPv6';
socket_ipv6.on('listening', common.fail); socket_ipv6.on('listening', common.fail);

2
test/parallel/test-dgram-pingpong.js

@ -11,7 +11,6 @@ function pingPongTest(port, host) {
var callbacks = 0; var callbacks = 0;
var N = 500; var N = 500;
var count = 0; var count = 0;
var sent_final_ping = false;
var server = dgram.createSocket('udp4', function(msg, rinfo) { var server = dgram.createSocket('udp4', function(msg, rinfo) {
if (debug) console.log('server got: ' + msg + if (debug) console.log('server got: ' + msg +
@ -48,7 +47,6 @@ function pingPongTest(port, host) {
if (count < N) { if (count < N) {
client.send(buf, 0, buf.length, port, 'localhost'); client.send(buf, 0, buf.length, port, 'localhost');
} else { } else {
sent_final_ping = true;
client.send(buf, 0, buf.length, port, 'localhost', function() { client.send(buf, 0, buf.length, port, 'localhost', function() {
client.close(); client.close();
}); });

1
test/parallel/test-domain-http-server.js

@ -9,7 +9,6 @@ objects.baz.asdf = objects;
var serverCaught = 0; var serverCaught = 0;
var clientCaught = 0; var clientCaught = 0;
var disposeEmit = 0;
var server = http.createServer(function(req, res) { var server = http.createServer(function(req, res) {
var dom = domain.create(); var dom = domain.create();

1
test/parallel/test-domain-implicit-fs.js

@ -9,7 +9,6 @@ var caught = 0;
var expectCaught = 1; var expectCaught = 1;
var d = new domain.Domain(); var d = new domain.Domain();
var e = new events.EventEmitter();
d.on('error', function(er) { d.on('error', function(er) {
console.error('caught', er); console.error('caught', er);

2
test/parallel/test-domain-uncaught-exception.js

@ -13,8 +13,6 @@ const assert = require('assert');
const domain = require('domain'); const domain = require('domain');
const child_process = require('child_process'); const child_process = require('child_process');
const uncaughtExceptions = {};
const tests = []; const tests = [];
function test1() { function test1() {

11
test/parallel/test-domain-with-abort-on-uncaught-exception.js

@ -31,7 +31,6 @@ const domainErrHandlerExMessage = 'exception from domain error handler';
if (process.argv[2] === 'child') { if (process.argv[2] === 'child') {
var domain = require('domain'); var domain = require('domain');
var d = domain.create(); var d = domain.create();
var triggeredProcessUncaughtException = false;
process.on('uncaughtException', function onUncaughtException() { process.on('uncaughtException', function onUncaughtException() {
// The process' uncaughtException event must not be emitted when // The process' uncaughtException event must not be emitted when
@ -116,17 +115,7 @@ if (process.argv[2] === 'child') {
var child = exec(cmdToExec); var child = exec(cmdToExec);
if (child) { if (child) {
var childTriggeredOnUncaughtExceptionHandler = false;
child.on('message', function onChildMsg(msg) {
if (msg === 'triggeredProcessUncaughtEx') {
childTriggeredOnUncaughtExceptionHandler = true;
}
});
child.on('exit', function onChildExited(exitCode, signal) { child.on('exit', function onChildExited(exitCode, signal) {
var expectedExitCodes;
var expectedSignals;
// When throwing errors from the top-level domain error handler // When throwing errors from the top-level domain error handler
// outside of a try/catch block, the process should not exit gracefully // outside of a try/catch block, the process should not exit gracefully
if (!options.useTryCatch && options.throwInDomainErrHandler) { if (!options.useTryCatch && options.throwInDomainErrHandler) {

2
test/parallel/test-dsa-fips-invalid-key.js

@ -12,8 +12,6 @@ var fs = require('fs');
var input = 'hello'; var input = 'hello';
var dsapub = fs.readFileSync(common.fixturesDir +
'/keys/dsa_public_1025.pem');
var dsapri = fs.readFileSync(common.fixturesDir + var dsapri = fs.readFileSync(common.fixturesDir +
'/keys/dsa_private_1025.pem'); '/keys/dsa_private_1025.pem');
var sign = crypto.createSign('DSS1'); var sign = crypto.createSign('DSS1');

2
test/parallel/test-eval.js

@ -10,7 +10,7 @@ var error_count = 0;
var cmd = ['"' + process.execPath + '"', '-e', '"console.error(process.argv)"', var cmd = ['"' + process.execPath + '"', '-e', '"console.error(process.argv)"',
'foo', 'bar'].join(' '); 'foo', 'bar'].join(' ');
var expected = util.format([process.execPath, 'foo', 'bar']) + '\n'; 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) { if (err) {
console.log(err.toString()); console.log(err.toString());
++error_count; ++error_count;

5
test/parallel/test-event-emitter-remove-listeners.js

@ -15,11 +15,6 @@ function listener2() {
count++; count++;
} }
function listener3() {
console.log('listener3');
count++;
}
function remove1() { function remove1() {
assert(0); assert(0);
} }

4
test/parallel/test-file-write-stream3.js

@ -124,7 +124,7 @@ function run_test_2() {
function run_test_3() { function run_test_3() {
var file, buffer, options; var file, options;
var data = '\u2026\u2026', // 3 bytes * 2 = 6 bytes in UTF-8 var data = '\u2026\u2026', // 3 bytes * 2 = 6 bytes in UTF-8
fileData; fileData;
@ -167,7 +167,7 @@ function run_test_3() {
function run_test_4() { function run_test_4() {
var file, options; var options;
options = { start: -5, options = { start: -5,
flags: 'r+' }; flags: 'r+' };

5
test/parallel/test-fs-open-flags.js

@ -7,14 +7,9 @@ var fs = require('fs');
var O_APPEND = constants.O_APPEND || 0; var O_APPEND = constants.O_APPEND || 0;
var O_CREAT = constants.O_CREAT || 0; var O_CREAT = constants.O_CREAT || 0;
var O_DIRECTORY = constants.O_DIRECTORY || 0;
var O_EXCL = constants.O_EXCL || 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_RDONLY = constants.O_RDONLY || 0;
var O_RDWR = constants.O_RDWR || 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_TRUNC = constants.O_TRUNC || 0;
var O_WRONLY = constants.O_WRONLY || 0; var O_WRONLY = constants.O_WRONLY || 0;

1
test/parallel/test-fs-open.js

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var constants = require('constants');
var assert = require('assert'); var assert = require('assert');
var fs = require('fs'); var fs = require('fs');

1
test/parallel/test-fs-read-buffer-tostring-fail.js

@ -6,7 +6,6 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const Buffer = require('buffer').Buffer; const Buffer = require('buffer').Buffer;
const kStringMaxLength = process.binding('buffer').kStringMaxLength; const kStringMaxLength = process.binding('buffer').kStringMaxLength;
const kMaxLength = process.binding('buffer').kMaxLength;
var fd; var fd;

2
test/parallel/test-fs-utimes.js

@ -48,7 +48,7 @@ function expect_ok(syscall, resource, err, atime, mtime) {
// would be even better though (node doesn't have such functionality yet) // would be even better though (node doesn't have such functionality yet)
function runTest(atime, mtime, callback) { function runTest(atime, mtime, callback) {
var fd, err; var fd;
// //
// test synchronized code paths, these functions throw on failure // test synchronized code paths, these functions throw on failure
// //

2
test/parallel/test-fs-write-file-sync.js

@ -15,7 +15,7 @@ fs._closeSync = fs.closeSync;
fs.closeSync = closeSync; fs.closeSync = closeSync;
// Reset the umask for testing // 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 // On Windows chmod is only able to manipulate read-only bit. Test if creating
// the file in read-only mode works. // the file in read-only mode works.

1
test/parallel/test-preload.js

@ -82,7 +82,6 @@ child_process.exec(nodeBinary + ' '
}); });
// https://github.com/nodejs/node/issues/1691 // https://github.com/nodejs/node/issues/1691
var originalCwd = process.cwd();
process.chdir(path.join(__dirname, '../fixtures/')); process.chdir(path.join(__dirname, '../fixtures/'));
child_process.exec(nodeBinary + ' ' child_process.exec(nodeBinary + ' '
+ '--expose_debug_as=v8debug ' + '--expose_debug_as=v8debug '

5
test/parallel/test-promises-unhandled-rejections.js

@ -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' + asyncTest('Test params of unhandledRejection for a synchronously-rejected' +
'promise', function(done) { 'promise', function(done) {
var e = new Error(); var e = new Error();
var e2 = new Error();
onUnhandledSucceed(done, function(reason, promise) { onUnhandledSucceed(done, function(reason, promise) {
assert.strictEqual(e, reason); assert.strictEqual(e, reason);
assert.strictEqual(promise, promise); assert.strictEqual(promise, promise);
}); });
var promise = Promise.reject(e); Promise.reject(e);
}); });
asyncTest('When re-throwing new errors in a promise catch, only the ' + 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); assert.strictEqual(domainReceivedError, domainError);
d.dispose(); d.dispose();
}); });
var a = Promise.reject(e); Promise.reject(e);
process.nextTick(function() { process.nextTick(function() {
throw domainError; throw domainError;
}); });

2
test/parallel/test-readline-undefined-columns.js

@ -11,7 +11,7 @@ const readline = require('readline');
const iStream = new PassThrough(); const iStream = new PassThrough();
const oStream = new PassThrough(); const oStream = new PassThrough();
const rli = readline.createInterface({ readline.createInterface({
terminal: true, terminal: true,
input: iStream, input: iStream,
output: oStream, output: oStream,

2
test/parallel/test-regress-GH-4256.js

@ -1,6 +1,6 @@
'use strict'; 'use strict';
require('../common'); require('../common');
process.domain = null; process.domain = null;
var timer = setTimeout(function() { setTimeout(function() {
console.log('this console.log statement should not make node crash'); console.log('this console.log statement should not make node crash');
}, 1); }, 1);

2
test/parallel/test-repl-autolibs.js

@ -8,7 +8,7 @@ var repl = require('repl');
common.globalCheck = false; common.globalCheck = false;
const putIn = new common.ArrayStream(); const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn, null, true); repl.start('', putIn, null, true);
test1(); test1();

2
test/parallel/test-repl-syntax-error-stack.js

@ -16,7 +16,7 @@ common.ArrayStream.prototype.write = function(output) {
}; };
const putIn = new common.ArrayStream(); const putIn = new common.ArrayStream();
const testMe = repl.start('', putIn); repl.start('', putIn);
let file = path.resolve(__dirname, '../fixtures/syntax/bad_syntax'); let file = path.resolve(__dirname, '../fixtures/syntax/bad_syntax');
if (common.isWindows) if (common.isWindows)

2
test/parallel/test-stream-pipe-error-handling.js

@ -38,7 +38,6 @@ var Stream = require('stream').Stream;
})(); })();
(function testErrorWithRemovedListenerThrows() { (function testErrorWithRemovedListenerThrows() {
var EE = require('events').EventEmitter;
var R = Stream.Readable; var R = Stream.Readable;
var W = Stream.Writable; var W = Stream.Writable;
@ -73,7 +72,6 @@ var Stream = require('stream').Stream;
})(); })();
(function testErrorWithRemovedListenerThrows() { (function testErrorWithRemovedListenerThrows() {
var EE = require('events').EventEmitter;
var R = Stream.Readable; var R = Stream.Readable;
var W = Stream.Writable; var W = Stream.Writable;

2
test/parallel/test-stream-push-order.js

@ -21,7 +21,7 @@ s._read = function(n) {
} }
}; };
var v = s.read(0); s.read(0);
// ACTUALLY [1, 3, 5, 6, 4, 2] // ACTUALLY [1, 3, 5, 6, 4, 2]

1
test/parallel/test-stream-unshift-read-race.js

@ -13,7 +13,6 @@ var stream = require('stream');
var hwm = 10; var hwm = 10;
var r = stream.Readable({ highWaterMark: hwm }); var r = stream.Readable({ highWaterMark: hwm });
var chunks = 10; var chunks = 10;
var t = (chunks * 5);
var data = new Buffer(chunks * hwm + Math.ceil(hwm / 2)); var data = new Buffer(chunks * hwm + Math.ceil(hwm / 2));
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {

2
test/parallel/test-stream-writev.js

@ -30,11 +30,9 @@ function test(decode, uncork, multi, next) {
function cnt(msg) { function cnt(msg) {
expectCount++; expectCount++;
var expect = expectCount; var expect = expectCount;
var called = false;
return function(er) { return function(er) {
if (er) if (er)
throw er; throw er;
called = true;
counter++; counter++;
assert.equal(counter, expect); assert.equal(counter, expect);
}; };

1
test/parallel/test-stream2-compatibility.js

@ -5,7 +5,6 @@ var W = require('_stream_writable');
var assert = require('assert'); var assert = require('assert');
var util = require('util'); var util = require('util');
var EE = require('events').EventEmitter;
var ondataCalled = 0; var ondataCalled = 0;

3
test/parallel/test-stream2-large-read-stall.js

@ -53,9 +53,6 @@ function push() {
setTimeout(push); setTimeout(push);
} }
// start the flow
var ret = r.read(0);
process.on('exit', function() { process.on('exit', function() {
assert.equal(pushes, PUSHCOUNT + 1); assert.equal(pushes, PUSHCOUNT + 1);
assert(endEmitted); assert(endEmitted);

2
test/parallel/test-stream2-objects.js

@ -167,8 +167,6 @@ test('read(0) for object streams', function(t) {
r.push('foobar'); r.push('foobar');
r.push(null); r.push(null);
var v = r.read(0);
r.pipe(toArray(function(array) { r.pipe(toArray(function(array) {
assert.deepEqual(array, ['foobar']); assert.deepEqual(array, ['foobar']);

4
test/parallel/test-stream2-readable-from-list.js

@ -39,8 +39,6 @@ process.nextTick(run);
test('buffers', function(t) { test('buffers', function(t) {
// have a length
var len = 16;
var list = [ new Buffer('foog'), var list = [ new Buffer('foog'),
new Buffer('bark'), new Buffer('bark'),
new Buffer('bazy'), new Buffer('bazy'),
@ -69,8 +67,6 @@ test('buffers', function(t) {
}); });
test('strings', function(t) { test('strings', function(t) {
// have a length
var len = 16;
var list = [ 'foog', var list = [ 'foog',
'bark', 'bark',
'bazy', 'bazy',

3
test/parallel/test-stream2-transform.js

@ -303,13 +303,10 @@ test('passthrough event emission', function(t) {
var pt = new PassThrough(); var pt = new PassThrough();
var emits = 0; var emits = 0;
pt.on('readable', function() { pt.on('readable', function() {
var state = pt._readableState;
console.error('>>> emit readable %d', emits); console.error('>>> emit readable %d', emits);
emits++; emits++;
}); });
var i = 0;
pt.write(new Buffer('foog')); pt.write(new Buffer('foog'));
console.error('need emit 0'); console.error('need emit 0');

3
test/parallel/test-timers-ordering.js

@ -3,13 +3,10 @@ require('../common');
var assert = require('assert'); var assert = require('assert');
var Timer = process.binding('timer_wrap').Timer; var Timer = process.binding('timer_wrap').Timer;
var i;
var N = 30; var N = 30;
var last_i = 0; var last_i = 0;
var last_ts = 0; var last_ts = 0;
var start = Timer.now();
var f = function(i) { var f = function(i) {
if (i <= N) { if (i <= N) {

2
test/parallel/test-timers-zero-timeout.js

@ -7,7 +7,7 @@ var assert = require('assert');
var ncalled = 0; var ncalled = 0;
setTimeout(f, 0, 'foo', 'bar', 'baz'); setTimeout(f, 0, 'foo', 'bar', 'baz');
var timer = setTimeout(function() {}, 0); setTimeout(function() {}, 0);
function f(a, b, c) { function f(a, b, c) {
assert.equal(a, 'foo'); assert.equal(a, 'foo');

3
test/parallel/test-url.js

@ -1514,9 +1514,6 @@ relativeTests2.forEach(function(relativeTest) {
//if format and parse are inverse operations then //if format and parse are inverse operations then
//resolveObject(parse(x), y) == parse(resolve(x, y)) //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] //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]),

Loading…
Cancel
Save