2017-03-15 21:48:11 +01:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const repl = require('repl');
|
|
|
|
|
|
|
|
{
|
|
|
|
let evalCalledWithExpectedArgs = false;
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
eval: common.mustCall((cmd, context) => {
|
|
|
|
// Assertions here will not cause the test to exit with an error code
|
2017-03-20 22:21:54 +01:00
|
|
|
// so set a boolean that is checked later instead.
|
2017-03-15 21:48:11 +01:00
|
|
|
evalCalledWithExpectedArgs = (cmd === '\n');
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
const r = repl.start(options);
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Empty strings should be sent to the repl's eval function
|
|
|
|
r.write('\n');
|
|
|
|
} finally {
|
|
|
|
r.write('.exit\n');
|
|
|
|
}
|
|
|
|
|
2017-03-20 22:21:54 +01:00
|
|
|
assert(evalCalledWithExpectedArgs);
|
2017-03-15 21:48:11 +01:00
|
|
|
}
|