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

Function test_insert_newline_in_middle

repl/src/editor.rs:853–885  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

851
852 #[test]
853 fn test_insert_newline_in_middle() {
854 let mut cb = MockConsole::default();
855 cb.set_size_chars(yx(10, 40));
856 let mut ob = OutputBuilder::new(yx(10, 40));
857 ob = ob.refresh(linecol(0, 0), &[""], yx(0, 0));
858
859 cb.add_input_chars("abc");
860 ob = ob.set_dirty();
861 ob = ob.add(CapturedOut::Write("a".to_string()));
862 ob = ob.quick_refresh(linecol(0, 1), yx(0, 1));
863 ob = ob.add(CapturedOut::Write("b".to_string()));
864 ob = ob.quick_refresh(linecol(0, 2), yx(0, 2));
865 ob = ob.add(CapturedOut::Write("c".to_string()));
866 ob = ob.quick_refresh(linecol(0, 3), yx(0, 3));
867
868 cb.add_input_keys(&[Key::ArrowLeft]);
869 ob = ob.quick_refresh(linecol(0, 2), yx(0, 2));
870
871 cb.add_input_keys(&[Key::NewLine]);
872 ob = ob.refresh(linecol(1, 0), &["ab", "c"], yx(1, 0));
873
874 cb.add_input_keys(&[Key::ArrowUp]);
875 ob = ob.quick_refresh(linecol(0, 0), yx(0, 0));
876 cb.add_input_keys(&[Key::ArrowRight]);
877 ob = ob.quick_refresh(linecol(0, 1), yx(0, 1));
878 cb.add_input_keys(&[Key::ArrowRight]);
879 ob = ob.quick_refresh(linecol(0, 2), yx(0, 2));
880
881 cb.add_input_keys(&[Key::NewLine]);
882 ob = ob.refresh(linecol(1, 0), &["ab", "", "c"], yx(1, 0));
883
884 run_editor("", "ab\n\nc\n", cb, ob);
885 }
886
887 #[test]
888 fn test_split_last_line() {

Callers

nothing calls this directly

Calls 10

yxFunction · 0.85
linecolFunction · 0.85
run_editorFunction · 0.85
refreshMethod · 0.80
set_dirtyMethod · 0.80
addMethod · 0.80
quick_refreshMethod · 0.80
add_input_keysMethod · 0.80
set_size_charsMethod · 0.45
add_input_charsMethod · 0.45

Tested by

no test coverage detected