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

Function run_editor

repl/src/editor.rs:709–718  ·  view source on GitHub ↗

Runs the editor and expects that the resulting text matches `exp_text` and that the side-effects on the console are those specified in `ob`. The editor can be pre-populated with some `previous` contents and the interactions with the editor are specified in `cb`. Note that the final Esc key press needed to exit the editor is automatically appended to `cb` here.

(previous: &str, exp_text: &str, mut console: MockConsole, ob: OutputBuilder)

Source from the content-addressed store, hash-verified

707 /// editor are specified in `cb`. Note that the final Esc key press needed to exit the editor
708 /// is automatically appended to `cb` here.
709 fn run_editor(previous: &str, exp_text: &str, mut console: MockConsole, ob: OutputBuilder) {
710 let mut editor = Editor::default();
711 editor.load(Some(TEST_FILENAME), previous);
712
713 console.add_input_keys(&[Key::Escape]);
714 block_on(editor.edit(&mut console)).unwrap();
715 assert_eq!(exp_text, editor.text());
716 assert_eq!(ob.dirty, editor.is_dirty());
717 assert_eq!(ob.build(), console.captured_out());
718 }
719
720 #[test]
721 fn test_program_behavior() {

Calls 3

add_input_keysMethod · 0.80
loadMethod · 0.45
editMethod · 0.45