11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst repl = require('repl'); 51cb0ef41Sopenharmony_ciconst { PassThrough } = require('stream'); 61cb0ef41Sopenharmony_ciconst input = new PassThrough(); 71cb0ef41Sopenharmony_ciconst output = new PassThrough(); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst r = repl.start({ 101cb0ef41Sopenharmony_ci input, output, 111cb0ef41Sopenharmony_ci eval: common.mustCall((code, context, filename, cb) => { 121cb0ef41Sopenharmony_ci r.setPrompt('prompt! '); 131cb0ef41Sopenharmony_ci cb(new Error('err')); 141cb0ef41Sopenharmony_ci }) 151cb0ef41Sopenharmony_ci}); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciinput.end('foo\n'); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci// The output includes exactly one post-error prompt. 201cb0ef41Sopenharmony_ciconst out = output.read().toString(); 211cb0ef41Sopenharmony_ciassert.match(out, /prompt!/); 221cb0ef41Sopenharmony_ciassert.doesNotMatch(out, /prompt![\S\s]*prompt!/); 231cb0ef41Sopenharmony_cioutput.on('data', common.mustNotCall()); 24