parent
216829e752
commit
df3a8fcb62
@ -80,8 +80,7 @@
|
||||
var module = new Module('eval');
|
||||
module.filename = path.join(cwd, 'eval');
|
||||
module.paths = Module._nodeModulePaths(cwd);
|
||||
var rv = module._compile('return eval(process._eval)', 'eval');
|
||||
console.log(rv);
|
||||
module._compile('eval(process._eval)', 'eval');
|
||||
|
||||
} else if (process.argv[1]) {
|
||||
// make process.argv[1] into a full path
|
||||
|
@ -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, '');
|
||||
});
|
||||
|
@ -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;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user