Browse Source

test: remove unused vars in ChildProcess tests

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: https://github.com/nodejs/node/pull/4425
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
process-exit-stdio-flushing
Rich Trott 9 years ago
parent
commit
2b1999b7c7
  1. 2
      test/parallel/test-child-process-buffering.js
  2. 2
      test/parallel/test-child-process-cwd.js
  3. 2
      test/parallel/test-child-process-exec-buffer.js
  4. 2
      test/parallel/test-child-process-exec-cwd.js
  5. 1
      test/parallel/test-child-process-fork-dgram.js
  6. 1
      test/parallel/test-child-process-fork-exec-path.js
  7. 1
      test/parallel/test-child-process-fork-ref2.js
  8. 1
      test/parallel/test-child-process-spawn-error.js
  9. 14
      test/parallel/test-child-process-stdin.js
  10. 2
      test/parallel/test-child-process-stdio-inherit.js
  11. 1
      test/parallel/test-child-process-stdio.js
  12. 1
      test/parallel/test-child-process-stdout-flush-exit.js

2
test/parallel/test-child-process-buffering.js

@ -2,8 +2,6 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn;
var pwd_called = false; var pwd_called = false;
var childClosed = false; var childClosed = false;
var childExited = false; var childExited = false;

2
test/parallel/test-child-process-cwd.js

@ -1,8 +1,6 @@
'use strict'; 'use strict';
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn;
var path = require('path');
var returns = 0; var returns = 0;

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

@ -9,7 +9,7 @@ var success_count = 0;
var str = 'hello'; var str = 'hello';
// default encoding // 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(stdout), 'Expected stdout to be a string');
assert.ok('string', typeof(stderr), 'Expected stderr to be a string'); assert.ok('string', typeof(stderr), 'Expected stderr to be a string');
assert.equal(str + os.EOL, stdout); assert.equal(str + os.EOL, stdout);

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

@ -16,7 +16,7 @@ if (common.isWindows) {
dir = '/dev'; dir = '/dev';
} }
var child = exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) { exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
if (err) { if (err) {
error_count++; error_count++;
console.log('error!: ' + err.code); console.log('error!: ' + err.code);

1
test/parallel/test-child-process-fork-dgram.js

@ -25,7 +25,6 @@ if (common.isWindows) {
} }
if (process.argv[2] === 'child') { if (process.argv[2] === 'child') {
var childCollected = 0;
var server; var server;
process.on('message', function removeMe(msg, clusterServer) { process.on('message', function removeMe(msg, clusterServer) {

1
test/parallel/test-child-process-fork-exec-path.js

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

1
test/parallel/test-child-process-fork-ref2.js

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var assert = require('assert');
var fork = require('child_process').fork; var fork = require('child_process').fork;
if (process.argv[2] === 'child') { if (process.argv[2] === 'child') {

1
test/parallel/test-child-process-spawn-error.js

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

14
test/parallel/test-child-process-stdin.js

@ -18,30 +18,20 @@ var response = '';
var exitStatus = -1; var exitStatus = -1;
var closed = false; var closed = false;
var gotStdoutEOF = false;
cat.stdout.setEncoding('utf8'); cat.stdout.setEncoding('utf8');
cat.stdout.on('data', function(chunk) { cat.stdout.on('data', function(chunk) {
console.log('stdout: ' + chunk); console.log('stdout: ' + chunk);
response += chunk; response += chunk;
}); });
cat.stdout.on('end', function() { cat.stdout.on('end', common.mustCall(function() {}));
gotStdoutEOF = true;
});
var gotStderrEOF = false;
cat.stderr.on('data', function(chunk) { cat.stderr.on('data', function(chunk) {
// shouldn't get any stderr output // shouldn't get any stderr output
assert.ok(false); assert.ok(false);
}); });
cat.stderr.on('end', function(chunk) { cat.stderr.on('end', common.mustCall(function() {}));
gotStderrEOF = true;
});
cat.on('exit', function(status) { cat.on('exit', function(status) {
console.log('exit event'); console.log('exit event');

2
test/parallel/test-child-process-stdio-inherit.js

@ -31,5 +31,5 @@ function grandparent() {
function parent() { function parent() {
// should not immediately exit. // should not immediately exit.
var child = common.spawnCat({ stdio: 'inherit' }); common.spawnCat({ stdio: 'inherit' });
} }

1
test/parallel/test-child-process-stdio.js

@ -1,7 +1,6 @@
'use strict'; 'use strict';
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn;
var options = {stdio: ['pipe']}; var options = {stdio: ['pipe']};
var child = common.spawnPwd(options); var child = common.spawnPwd(options);

1
test/parallel/test-child-process-stdout-flush-exit.js

@ -1,7 +1,6 @@
'use strict'; 'use strict';
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var path = require('path');
// if child process output to console and exit // if child process output to console and exit
if (process.argv[2] === 'child') { if (process.argv[2] === 'child') {

Loading…
Cancel
Save