Improve test to preserve internal spacing and to inspect error

This commit is contained in:
Joran Dirk Greef 2019-06-03 16:28:58 +02:00
parent 711dea9623
commit 799fd96680

View file

@ -28,7 +28,8 @@ kill(
var command = 'echo %SUDO_PROMPT_TEST_ENV%'; var command = 'echo %SUDO_PROMPT_TEST_ENV%';
var expected = 'hello world\r\n'; var expected = 'hello world\r\n';
} else { } else {
var command = 'echo $SUDO_PROMPT_TEST_ENV'; // We use double quotes to tell echo to preserve internal space:
var command = 'echo "$SUDO_PROMPT_TEST_ENV"';
var expected = 'hello world\n'; var expected = 'hello world\n';
} }
console.log( console.log(
@ -39,7 +40,7 @@ kill(
); );
sudo.exec(command, options, sudo.exec(command, options,
function(error, stdout, stderr) { function(error, stdout, stderr) {
console.log('error: ' + error); console.log('error:', error);
console.log('stdout: ' + JSON.stringify(stdout)); console.log('stdout: ' + JSON.stringify(stdout));
console.log('stderr: ' + JSON.stringify(stderr)); console.log('stderr: ' + JSON.stringify(stderr));
kill( kill(