Skip to content

Commit

Permalink
test: use assert.strictEqual in test-cli-eval
Browse files Browse the repository at this point in the history
PR-URL: #9919
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
NigelKibodeaux authored and Fishrock123 committed Dec 6, 2016
1 parent 0a07bcc commit d697ac4
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions test/parallel/test-cli-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ var filename = __filename.replace(/\\/g, '/');
// assert that nothing is written to stdout
child.exec(nodejs + ' --eval 42',
function(err, stdout, stderr) {
assert.equal(stdout, '');
assert.equal(stderr, '');
assert.strictEqual(stdout, '');
assert.strictEqual(stderr, '');
});

// assert that "42\n" is written to stderr
child.exec(nodejs + ' --eval "console.error(42)"',
function(err, stdout, stderr) {
assert.equal(stdout, '');
assert.equal(stderr, '42\n');
assert.strictEqual(stdout, '');
assert.strictEqual(stderr, '42\n');
});

// assert that the expected output is written to stdout
Expand All @@ -36,21 +36,21 @@ child.exec(nodejs + ' --eval "console.error(42)"',

child.exec(cmd + '42',
function(err, stdout, stderr) {
assert.equal(stdout, '42\n');
assert.equal(stderr, '');
assert.strictEqual(stdout, '42\n');
assert.strictEqual(stderr, '');
});

child.exec(cmd + "'[]'", common.mustCall(
function(err, stdout, stderr) {
assert.equal(stdout, '[]\n');
assert.equal(stderr, '');
assert.strictEqual(stdout, '[]\n');
assert.strictEqual(stderr, '');
}));
});

// assert that module loading works
child.exec(nodejs + ' --eval "require(\'' + filename + '\')"',
function(status, stdout, stderr) {
assert.equal(status.code, 42);
assert.strictEqual(status.code, 42);
});

// Check that builtin modules are pre-defined.
Expand All @@ -63,7 +63,7 @@ child.exec(nodejs + ' --print "os.platform()"',
// module path resolve bug, regression test
child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"',
function(status, stdout, stderr) {
assert.equal(status.code, 42);
assert.strictEqual(status.code, 42);
});

// Missing argument should not crash
Expand All @@ -74,28 +74,29 @@ child.exec(nodejs + ' -e', common.mustCall(function(status, stdout, stderr) {

// empty program should do nothing
child.exec(nodejs + ' -e ""', function(status, stdout, stderr) {
assert.equal(stdout, '');
assert.equal(stderr, '');
assert.strictEqual(stdout, '');
assert.strictEqual(stderr, '');
});

// "\\-42" should be interpreted as an escaped expression, not a switch
child.exec(nodejs + ' -p "\\-42"',
function(err, stdout, stderr) {
assert.equal(stdout, '-42\n');
assert.equal(stderr, '');
assert.strictEqual(stdout, '-42\n');
assert.strictEqual(stderr, '');
});

child.exec(nodejs + ' --use-strict -p process.execArgv',
function(status, stdout, stderr) {
assert.equal(stdout, "[ '--use-strict', '-p', 'process.execArgv' ]\n");
assert.strictEqual(stdout,
"[ '--use-strict', '-p', 'process.execArgv' ]\n");
});

// Regression test for https://github.com/nodejs/node/issues/3574
const emptyFile = path.join(common.fixturesDir, 'empty.js');
child.exec(nodejs + ` -e 'require("child_process").fork("${emptyFile}")'`,
function(status, stdout, stderr) {
assert.equal(stdout, '');
assert.equal(stderr, '');
assert.strictEqual(stdout, '');
assert.strictEqual(stderr, '');
});

// Regression test for https://github.com/nodejs/node/issues/8534.
Expand Down

0 comments on commit d697ac4

Please sign in to comment.