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

Function test_program_behavior

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

Source from the content-addressed store, hash-verified

719
720 #[test]
721 fn test_program_behavior() {
722 let mut editor = Editor::default();
723 assert!(editor.text().is_empty());
724 assert!(!editor.is_dirty());
725
726 let mut console = MockConsole::default();
727 console.set_size_chars(yx(10, 40));
728 console.add_input_keys(&[Key::Escape]);
729 block_on(editor.edit(&mut console)).unwrap();
730 assert!(!editor.is_dirty());
731
732 console.add_input_keys(&[Key::Char('x'), Key::Escape]);
733 block_on(editor.edit(&mut console)).unwrap();
734 assert!(editor.is_dirty());
735
736 editor.load(Some(TEST_FILENAME), "some text\n and more\n");
737 assert_eq!("some text\n and more\n", editor.text());
738 assert!(!editor.is_dirty());
739
740 editor.load(Some(TEST_FILENAME), "different\n");
741 assert_eq!("different\n", editor.text());
742 assert!(!editor.is_dirty());
743
744 console.add_input_keys(&[Key::Char('x'), Key::Escape]);
745 block_on(editor.edit(&mut console)).unwrap();
746 assert!(editor.is_dirty());
747
748 editor.set_name("SAVED");
749 assert!(!editor.is_dirty());
750 }
751
752 #[test]
753 fn test_force_trailing_newline() {

Callers

nothing calls this directly

Calls 6

yxFunction · 0.85
add_input_keysMethod · 0.80
set_size_charsMethod · 0.45
editMethod · 0.45
loadMethod · 0.45
set_nameMethod · 0.45

Tested by

no test coverage detected