MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_run_repl_loop_signal_before_exec

Function test_run_repl_loop_signal_before_exec

repl/src/lib.rs:549–567  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

547
548 #[test]
549 fn test_run_repl_loop_signal_before_exec() {
550 let mut tester = Tester::default();
551 let (console, program) = (tester.get_console(), tester.get_program());
552 let (signals_tx, signals_rx) = async_channel::unbounded();
553 let mut machine = endbasic_std::MachineBuilder::default()
554 .with_console(console.clone())
555 .with_signals_chan((signals_tx.clone(), signals_rx))
556 .build();
557
558 {
559 let mut console = console.borrow_mut();
560 console.add_input_chars("PRINT");
561 block_on(signals_tx.send(Signal::Break)).unwrap();
562 console.add_input_chars(" 123");
563 console.add_input_keys(&[Key::NewLine, Key::EofOrDelete]);
564 }
565 block_on(run_repl_loop(&mut machine, console, program)).unwrap();
566 tester.run("").expect_prints([" 123", "End of input by CTRL-D"]).check();
567 }
568
569 #[test]
570 fn test_run_repl_loop_eof_during_input_does_not_exit_repl() {

Callers

nothing calls this directly

Calls 11

with_signals_chanMethod · 0.80
with_consoleMethod · 0.80
add_input_keysMethod · 0.80
run_repl_loopFunction · 0.70
get_consoleMethod · 0.45
get_programMethod · 0.45
buildMethod · 0.45
add_input_charsMethod · 0.45
checkMethod · 0.45
expect_printsMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected