()
| 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() { |
nothing calls this directly
no test coverage detected