Skip to content

Commit

Permalink
test: remove unused vars in ChildProcess tests
Browse files Browse the repository at this point in the history
In addition to removing unused vars, this also fixes an instance where
booleans were set presumably to check something but then never used.
This now confirms that the events that were setting the booleans are
fired.

PR-URL: nodejs#4425
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and Fishrock123 committed Jan 6, 2016
1 parent e72112f commit 54004f0
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 25 deletions.
2 changes: 0 additions & 2 deletions test/parallel/test-child-process-buffering.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
var common = require('../common');
var assert = require('assert');

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

var pwd_called = false;
var childClosed = false;
var childExited = false;
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-child-process-cwd.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 spawn = require('child_process').spawn;
var path = require('path');

var returns = 0;

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 @@ -9,7 +9,7 @@ var success_count = 0;
var str = 'hello';

// default encoding
var child = exec('echo ' + str, function(err, stdout, stderr) {
exec('echo ' + str, function(err, stdout, stderr) {
assert.ok('string', typeof(stdout), 'Expected stdout to be a string');
assert.ok('string', typeof(stderr), 'Expected stderr to be a string');
assert.equal(str + os.EOL, stdout);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-exec-cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (common.isWindows) {
dir = '/dev';
}

var child = exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
if (err) {
error_count++;
console.log('error!: ' + err.code);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if (common.isWindows) {
}

if (process.argv[2] === 'child') {
var childCollected = 0;
var server;

process.on('message', function removeMe(msg, clusterServer) {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-exec-path.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var assert = require('assert');
var cp = require('child_process');
var fs = require('fs');
var path = require('path');
var common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-ref2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var fork = require('child_process').fork;

if (process.argv[2] === 'child') {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-spawn-error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var fs = require('fs');
var spawn = require('child_process').spawn;
var assert = require('assert');

Expand Down
14 changes: 2 additions & 12 deletions test/parallel/test-child-process-stdin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,20 @@ var response = '';
var exitStatus = -1;
var closed = false;

var gotStdoutEOF = false;

cat.stdout.setEncoding('utf8');
cat.stdout.on('data', function(chunk) {
console.log('stdout: ' + chunk);
response += chunk;
});

cat.stdout.on('end', function() {
gotStdoutEOF = true;
});


var gotStderrEOF = false;
cat.stdout.on('end', common.mustCall(function() {}));

cat.stderr.on('data', function(chunk) {
// shouldn't get any stderr output
assert.ok(false);
});

cat.stderr.on('end', function(chunk) {
gotStderrEOF = true;
});

cat.stderr.on('end', common.mustCall(function() {}));

cat.on('exit', function(status) {
console.log('exit event');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-stdio-inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ function grandparent() {

function parent() {
// should not immediately exit.
var child = common.spawnCat({ stdio: 'inherit' });
common.spawnCat({ stdio: 'inherit' });
}
1 change: 0 additions & 1 deletion test/parallel/test-child-process-stdio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

var options = {stdio: ['pipe']};
var child = common.spawnPwd(options);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-stdout-flush-exit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var path = require('path');

// if child process output to console and exit
if (process.argv[2] === 'child') {
Expand Down

0 comments on commit 54004f0

Please sign in to comment.