1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const repl = require('repl'); 5 6{ 7 let evalCalledWithExpectedArgs = false; 8 9 const options = { 10 eval: common.mustCall((cmd, context) => { 11 // Assertions here will not cause the test to exit with an error code 12 // so set a boolean that is checked later instead. 13 evalCalledWithExpectedArgs = (cmd === '\n'); 14 }) 15 }; 16 17 const r = repl.start(options); 18 19 try { 20 // Empty strings should be sent to the repl's eval function 21 r.write('\n'); 22 } finally { 23 r.write('.exit\n'); 24 } 25 26 assert(evalCalledWithExpectedArgs); 27} 28