Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-07-26 01:54:44 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2011-07-26 01:59:10 +0400
commitdf3a8fcb62e44fa1b1c592f04a872648d26ec08c (patch)
treeefb5b8ffec07ace0db6febdc38ca69b123294b5b /test
parent216829e7520a56ef0bede9fc8387c2de9683e4c0 (diff)
cli: don't print result of --eval
Fixes #572.
Diffstat (limited to 'test')
-rw-r--r--test/simple/test-cli-eval.js14
-rw-r--r--test/simple/test-eval.js4
2 files changed, 12 insertions, 6 deletions
diff --git a/test/simple/test-cli-eval.js b/test/simple/test-cli-eval.js
index 3340d013843..6590442aadb 100644
--- a/test/simple/test-cli-eval.js
+++ b/test/simple/test-cli-eval.js
@@ -30,10 +30,16 @@ if (module.parent) {
process.exit(42);
}
-// assert that the result of the final expression is written to stdout
-child.exec(nodejs + ' --eval "1337; 42"',
+// assert that nothing is written to stdout
+child.exec(nodejs + ' --eval 42',
function(err, stdout, stderr) {
- assert.equal(parseInt(stdout), 42);
+ assert.equal(stdout, '');
+ });
+
+// assert that nothing is written to stdout
+child.exec(nodejs + ' --eval console.log(42)',
+ function(err, stdout, stderr) {
+ assert.equal(stdout, '');
});
// assert that module loading works
@@ -50,6 +56,6 @@ child.exec(nodejs + ' --eval "require(\'./test/simple/test-cli-eval.js\')"',
// empty program should do nothing
child.exec(nodejs + ' -e ""', function(status, stdout, stderr) {
- assert.equal(stdout, 'undefined\n');
+ assert.equal(stdout, '');
assert.equal(stderr, '');
});
diff --git a/test/simple/test-eval.js b/test/simple/test-eval.js
index c80ad8d2a45..c3db977fa09 100644
--- a/test/simple/test-eval.js
+++ b/test/simple/test-eval.js
@@ -26,7 +26,7 @@ var exec = require('child_process').exec;
var success_count = 0;
var error_count = 0;
-var cmd = [process.execPath, '-e', '"process.argv"', 'foo', 'bar'].join(' ');
+var cmd = [process.execPath, '-e', '"console.error(process.argv)"', 'foo', 'bar'].join(' ');
var expected = "[ '" + process.execPath + "',\n 'foo',\n 'bar' ]\n";
var child = exec(cmd, function(err, stdout, stderr) {
if (err) {
@@ -34,7 +34,7 @@ var child = exec(cmd, function(err, stdout, stderr) {
++error_count;
return;
}
- assert.equal(stdout, expected);
+ assert.equal(stderr, expected);
++success_count;
});