Skip to content

Commit

Permalink
test: remove unused assert module imports
Browse files Browse the repository at this point in the history
Many test modules load assert but do not use it. This change removes
those instances.

It also removes a handful of other unused variables when they were
nearby.

PR-URL: nodejs#4438
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and Michael Scovetta committed Apr 2, 2016
1 parent f77e6d6 commit a1b7917
Show file tree
Hide file tree
Showing 42 changed files with 12 additions and 60 deletions.
1 change: 0 additions & 1 deletion test/addons/buffer-free-callback/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Flags: --expose-gc

require('../../common');
var assert = require('assert');
var binding = require('./build/Release/binding');

function check(size) {
Expand Down
1 change: 0 additions & 1 deletion test/message/2100bytes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var util = require('util');

console.log([
Expand Down
1 change: 0 additions & 1 deletion test/message/eval_messages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

require('../common');
var assert = require('assert');

var spawn = require('child_process').spawn;

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

console.log('hello world');
1 change: 0 additions & 1 deletion test/message/nexttick_throw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

process.nextTick(function() {
process.nextTick(function() {
Expand Down
1 change: 0 additions & 1 deletion test/message/stack_overflow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

Error.stackTraceLimit = 0;

Expand Down
1 change: 0 additions & 1 deletion test/message/stdin_messages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

require('../common');
var assert = require('assert');

var spawn = require('child_process').spawn;

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

// custom error throwing
throw ({ name: 'MyCustomError', message: 'This is a custom message' });
2 changes: 1 addition & 1 deletion test/message/throw_custom_error.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*test*message*throw_custom_error.js:6
*test*message*throw_custom_error.js:5
throw ({ name: 'MyCustomError', message: 'This is a custom message' });
^
MyCustomError: This is a custom message
1 change: 0 additions & 1 deletion test/message/throw_in_line_with_tabs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable indent */
'use strict';
require('../common');
var assert = require('assert');

console.error('before');

Expand Down
2 changes: 1 addition & 1 deletion test/message/throw_in_line_with_tabs.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
before
*test*message*throw_in_line_with_tabs.js:10
*test*message*throw_in_line_with_tabs.js:9
throw ({ foo: 'bar' });
^
[object Object]
1 change: 0 additions & 1 deletion test/message/throw_non_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

// custom error throwing
throw ({ foo: 'bar' });
2 changes: 1 addition & 1 deletion test/message/throw_non_error.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*test*message*throw_non_error.js:6
*test*message*throw_non_error.js:5
throw ({ foo: 'bar' });
^
[object Object]
1 change: 0 additions & 1 deletion test/message/throw_null.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
require('../common');
var assert = require('assert');

throw null;
2 changes: 1 addition & 1 deletion test/message/throw_null.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

*test*message*throw_null.js:5
*test*message*throw_null.js:4
throw null;
^
null
1 change: 0 additions & 1 deletion test/message/throw_undefined.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
require('../common');
var assert = require('assert');

throw undefined;
2 changes: 1 addition & 1 deletion test/message/throw_undefined.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

*test*message*throw_undefined.js:5
*test*message*throw_undefined.js:4
throw undefined;
^
undefined
1 change: 0 additions & 1 deletion test/message/timeout_throw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

setTimeout(function() {
undefined_reference_error_maker;
Expand Down
1 change: 0 additions & 1 deletion test/message/undefined_reference_in_new_context.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var vm = require('vm');

console.error('before');
Expand Down
1 change: 0 additions & 1 deletion test/message/vm_display_runtime_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var vm = require('vm');

console.error('beginning');
Expand Down
3 changes: 1 addition & 2 deletions test/message/vm_display_syntax_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var assert = require('assert');
require('../common');
var vm = require('vm');

console.error('beginning');
Expand Down
3 changes: 1 addition & 2 deletions test/message/vm_dont_display_runtime_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var assert = require('assert');
require('../common');
var vm = require('vm');

console.error('beginning');
Expand Down
1 change: 0 additions & 1 deletion test/message/vm_dont_display_syntax_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var vm = require('vm');

console.error('beginning');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-dgram-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
var NUM_WORKERS = 4;
var PACKETS_PER_WORKER = 10;

var assert = require('assert');
var cluster = require('cluster');
var common = require('../common');
var dgram = require('dgram');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-rr-ref.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');

Expand Down
13 changes: 4 additions & 9 deletions test/parallel/test-crypto-verify-failure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var assert = require('assert');

if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
Expand All @@ -20,8 +19,6 @@ var options = {
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
};

var canSend = true;

var server = tls.Server(options, function(socket) {
setImmediate(function() {
console.log('sending');
Expand All @@ -32,17 +29,15 @@ var server = tls.Server(options, function(socket) {
});
});

var client;

function verify() {
console.log('verify');
var verified = crypto.createVerify('RSA-SHA1')
.update('Test')
.verify(certPem, 'asdfasdfas', 'base64');
crypto.createVerify('RSA-SHA1')
.update('Test')
.verify(certPem, 'asdfasdfas', 'base64');
}

server.listen(common.PORT, function() {
client = tls.connect({
tls.connect({
port: common.PORT,
rejectUnauthorized: false
}, function() {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dgram-empty-packet.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');

var fs = require('fs');
var dgram = require('dgram');
var callbacks = 0;
var client;
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-dgram-send-empty-buffer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
'use strict';
var common = require('../common');
var assert = require('assert');

var fs = require('fs');
var dgram = require('dgram');
var callbacks = 0;
var client, timer, buf;

if (process.platform === 'darwin') {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-domain-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Make sure that the domain stack doesn't get out of hand.

require('../common');
var assert = require('assert');
var domain = require('domain');
var events = require('events');

var a = domain.create();
a.name = 'a';
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-repl-domain.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';
var assert = require('assert');
var common = require('../common');

var repl = require('repl');

const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn);
repl.start('', putIn);

putIn.write = function(data) {
// Don't use assert for this because the domain might catch it, and
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-require-extensions-main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
var common = require('../common');
var assert = require('assert');

require(common.fixturesDir + '/require-bin/bin/req.js');
1 change: 0 additions & 1 deletion test/parallel/test-stream-pipe-cleanup-pause.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const stream = require('stream');

const reader = new stream.Readable();
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-stream2-pipe-error-once-listener.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

var util = require('util');
var stream = require('stream');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-timers-non-integer-delay.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

require('../common');
var assert = require('assert');

var TIMEOUT_DELAY = 1.1;
var NB_TIMEOUTS_FIRED = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

const common = require('../common');
const assert = require('assert');
const net = require('net');

const clients = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* considered public interface.
*/
const common = require('../common');
const assert = require('assert');
const timers = require('timers');

const foo = {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-timers-unrefd-interval-still-fires.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* This test is a regression test for joyent/node#8900.
*/
const common = require('../common');
const assert = require('assert');

const TEST_DURATION = common.platformTimeout(100);
const N = 5;
Expand Down
1 change: 0 additions & 1 deletion test/pummel/test-fs-watch-non-recursive.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var path = require('path');
var fs = require('fs');

Expand Down
1 change: 0 additions & 1 deletion test/pummel/test-http-upload-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// 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.
var common = require('../common'),
assert = require('assert'),
http = require('http'),
server = http.createServer(),
connections = 0;
Expand Down
1 change: 0 additions & 1 deletion test/pummel/test-next-tick-infinite-calls.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');

var complete = 0;

Expand Down
1 change: 0 additions & 1 deletion test/sequential/test-regress-GH-819.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
require('../common');
var net = require('net');
var assert = require('assert');

// Connect to something that we need to DNS resolve
var c = net.createConnection(80, 'google.com');
Expand Down
4 changes: 0 additions & 4 deletions test/sequential/test-stream2-stderr-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// Make sure that sync writes to stderr get processed before exiting.

require('../common');
var assert = require('assert');
var util = require('util');

var errnoException = util._errnoException;

function parent() {
var spawn = require('child_process').spawn;
Expand Down

0 comments on commit a1b7917

Please sign in to comment.