diff options
-rw-r--r-- | src/confirm_abort/mod.rs | 36 | ||||
-rw-r--r-- | src/confirm_rebase/mod.rs | 36 | ||||
-rw-r--r-- | src/external_editor/tests.rs | 210 | ||||
-rw-r--r-- | src/insert/tests.rs | 34 | ||||
-rw-r--r-- | src/list/tests.rs | 172 | ||||
-rw-r--r-- | src/process/error.rs | 51 | ||||
-rw-r--r-- | src/process/modules.rs | 16 | ||||
-rw-r--r-- | src/process/tests.rs | 404 | ||||
-rw-r--r-- | src/process/testutil.rs | 18 | ||||
-rw-r--r-- | src/process/window_size_error.rs | 76 | ||||
-rw-r--r-- | src/show_commit/tests.rs | 138 |
11 files changed, 397 insertions, 794 deletions
diff --git a/src/confirm_abort/mod.rs b/src/confirm_abort/mod.rs index 27197d8..7543e5e 100644 --- a/src/confirm_abort/mod.rs +++ b/src/confirm_abort/mod.rs @@ -52,36 +52,30 @@ mod tests { assert_process_result, assert_rendered_output, input::{Event, KeyCode, MetaEvent}, - process::testutil::{process_module_test, TestContext, ViewState}, + process::testutil::{process_module_test, TestContext}, }; #[test] fn build_view_data() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |test_context: TestContext<'_>| { - let mut module = ConfirmAbort::new( - &test_context.config.key_bindings.confirm_yes, - &test_context.config.key_bindings.confirm_no, - ); - let view_data = test_context.build_view_data(&mut module); - assert_rendered_output!( - view_data, - "{TITLE}", - "{BODY}", - "{Normal}Are you sure you want to abort (y/n)? " - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |test_context: TestContext<'_>| { + let mut module = ConfirmAbort::new( + &test_context.config.key_bindings.confirm_yes, + &test_context.config.key_bindings.confirm_no, + ); + let view_data = test_context.build_view_data(&mut module); + assert_rendered_output!( + view_data, + "{TITLE}", + "{BODY}", + "{Normal}Are you sure you want to abort (y/n)? " + ); + }); } #[test] fn handle_event_yes() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(MetaEvent::Yes)], |mut test_context: TestContext<'_>| { let mut module = ConfirmAbort::new( @@ -102,7 +96,6 @@ mod tests { fn handle_event_no() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(MetaEvent::No)], |mut test_context: TestContext<'_>| { let mut module = ConfirmAbort::new( @@ -122,7 +115,6 @@ mod tests { fn handle_event_confirmed_other() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(KeyCode::Null)], |mut test_context: TestContext<'_>| { let mut module = ConfirmAbort::new( diff --git a/src/confirm_rebase/mod.rs b/src/confirm_rebase/mod.rs index 039e829..a047623 100644 --- a/src/confirm_rebase/mod.rs +++ b/src/confirm_rebase/mod.rs @@ -47,36 +47,30 @@ mod tests { assert_process_result, assert_rendered_output, input::{Event, KeyCode, MetaEvent}, - process::testutil::{process_module_test, TestContext, ViewState}, + process::testutil::{process_module_test, TestContext}, }; #[test] fn build_view_data() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |test_context: TestContext<'_>| { - let mut module = ConfirmRebase::new( - &test_context.config.key_bindings.confirm_yes, - &test_context.config.key_bindings.confirm_no, - ); - let view_data = test_context.build_view_data(&mut module); - assert_rendered_output!( - view_data, - "{TITLE}", - "{BODY}", - "{Normal}Are you sure you want to rebase (y/n)? " - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |test_context: TestContext<'_>| { + let mut module = ConfirmRebase::new( + &test_context.config.key_bindings.confirm_yes, + &test_context.config.key_bindings.confirm_no, + ); + let view_data = test_context.build_view_data(&mut module); + assert_rendered_output!( + view_data, + "{TITLE}", + "{BODY}", + "{Normal}Are you sure you want to rebase (y/n)? " + ); + }); } #[test] fn handle_event_yes() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(MetaEvent::Yes)], |mut test_context: TestContext<'_>| { let mut module = ConfirmRebase::new( @@ -97,7 +91,6 @@ mod tests { fn handle_event_no() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(MetaEvent::No)], |mut test_context: TestContext<'_>| { let mut module = ConfirmRebase::new( @@ -117,7 +110,6 @@ mod tests { fn handle_event_no_match_key() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(KeyCode::Null)], |mut test_context: TestContext<'_>| { let mut module = ConfirmRebase::new( diff --git a/src/external_editor/tests.rs b/src/external_editor/tests.rs index 131b2aa..88e3f46 100644 --- a/src/external_editor/tests.rs +++ b/src/external_editor/tests.rs @@ -3,7 +3,7 @@ use crate::{ assert_process_result, assert_rendered_output, input::{Event, KeyCode}, - process::testutil::{process_module_test, TestContext, ViewState}, + process::testutil::{process_module_test, TestContext}, }; fn assert_external_editor_state_eq(actual: &ExternalEditorState, expected: &ExternalEditorState) { @@ -48,7 +48,6 @@ macro_rules! assert_external_editor_state_eq { fn activate() { process_module_test( &["pick aaa comment1", "drop bbb comment2"], - ViewState::default(), &[], |test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -76,26 +75,21 @@ fn activate() { #[test] fn activate_write_file_fail() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |test_context: TestContext<'_>| { - let todo_path = test_context.get_todo_file_path(); - let mut module = ExternalEditor::new("editor"); - test_context.set_todo_file_readonly(); - assert_process_result!( - test_context.activate(&mut module, State::List), - state = State::List, - error = anyhow!("Error opening file: {}: Permission denied (os error 13)", todo_path) - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |test_context: TestContext<'_>| { + let todo_path = test_context.get_todo_file_path(); + let mut module = ExternalEditor::new("editor"); + test_context.set_todo_file_readonly(); + assert_process_result!( + test_context.activate(&mut module, State::List), + state = State::List, + error = anyhow!("Error opening file: {}: Permission denied (os error 13)", todo_path) + ); + }); } #[test] fn activate_file_placement_marker() { - process_module_test(&[], ViewState::default(), &[], |test_context: TestContext<'_>| { + process_module_test(&[], &[], |test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor a % b"); assert_process_result!( test_context.activate(&mut module, State::List), @@ -112,7 +106,6 @@ fn activate_file_placement_marker() { fn deactivate() { process_module_test( &["pick aaa comment", "drop bbb comment2"], - ViewState::default(), &[], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -124,34 +117,28 @@ fn deactivate() { #[test] fn edit_success() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |mut test_context: TestContext<'_>| { - test_context - .event_handler_context - .event_handler - .push_event(Event::from(MetaEvent::ExternalCommandSuccess)); - let mut module = ExternalEditor::new("editor"); - test_context.activate(&mut module, State::List); - let view_data = test_context.build_view_data(&mut module); - assert_rendered_output!(view_data, "{TITLE}", "{LEADING}", "{Normal}Editing..."); - assert_process_result!( - test_context.handle_event(&mut module), - event = Event::from(MetaEvent::ExternalCommandSuccess), - state = State::List - ); - assert_external_editor_state_eq!(module.state, ExternalEditorState::Active); - }, - ); + process_module_test(&["pick aaa comment"], &[], |mut test_context: TestContext<'_>| { + test_context + .event_handler_context + .event_handler + .push_event(Event::from(MetaEvent::ExternalCommandSuccess)); + let mut module = ExternalEditor::new("editor"); + test_context.activate(&mut module, State::List); + let view_data = test_context.build_view_data(&mut module); + assert_rendered_output!(view_data, "{TITLE}", "{LEADING}", "{Normal}Editing..."); + assert_process_result!( + test_context.handle_event(&mut module), + event = Event::from(MetaEvent::ExternalCommandSuccess), + state = State::List + ); + assert_external_editor_state_eq!(module.state, ExternalEditorState::Active); + }); } #[test] fn empty_edit_error() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('1')], |mut test_context: TestContext<'_>| { test_context @@ -189,7 +176,6 @@ fn empty_edit_error() { fn empty_edit_abort_rebase() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('1')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -208,7 +194,6 @@ fn empty_edit_abort_rebase() { fn empty_edit_re_edit_rebase_file() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('2')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -230,7 +215,6 @@ fn empty_edit_re_edit_rebase_file() { fn empty_edit_undo_and_edit() { process_module_test( &["pick aaa comment", "drop bbb comment"], - ViewState::default(), &[Event::from('3')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -254,95 +238,79 @@ fn empty_edit_undo_and_edit() { #[test] fn empty_edit_noop() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |mut test_context: TestContext<'_>| { - let mut module = ExternalEditor::new("editor"); - test_context.activate(&mut module, State::List); - module.state = ExternalEditorState::Empty; - test_context.rebase_todo_file.set_lines(vec![]); - let view_data = test_context.build_view_data(&mut module); - assert_rendered_output!( - view_data, - "{TITLE}", - "{LEADING}", - "{Normal}The rebase file is empty.", - "", - "{BODY}", - "{Normal}1) Abort rebase", - "{Normal}2) Edit rebase file", - "{Normal}3) Undo modifications and edit rebase file", - "", - "{IndicatorColor}Please choose an option." - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |mut test_context: TestContext<'_>| { + let mut module = ExternalEditor::new("editor"); + test_context.activate(&mut module, State::List); + module.state = ExternalEditorState::Empty; + test_context.rebase_todo_file.set_lines(vec![]); + let view_data = test_context.build_view_data(&mut module); + assert_rendered_output!( + view_data, + "{TITLE}", + "{LEADING}", + "{Normal}The rebase file is empty.", + "", + "{BODY}", + "{Normal}1) Abort rebase", + "{Normal}2) Edit rebase file", + "{Normal}3) Undo modifications and edit rebase file", + "", + "{IndicatorColor}Please choose an option." + ); + }); } #[test] fn no_editor_set() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |test_context: TestContext<'_>| { - let mut module = ExternalEditor::new(""); - assert_process_result!( - test_context.activate(&mut module, State::List), - state = State::List, - error = anyhow!("No editor configured: Please see the git \"core.editor\" configuration for details") - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |test_context: TestContext<'_>| { + let mut module = ExternalEditor::new(""); + assert_process_result!( + test_context.activate(&mut module, State::List), + state = State::List, + error = anyhow!("No editor configured: Please see the git \"core.editor\" configuration for details") + ); + }); } #[test] fn editor_non_zero_exit() { - process_module_test( - &["pick aaa comment"], - ViewState::default(), - &[], - |mut test_context: TestContext<'_>| { - let mut module = ExternalEditor::new("editor"); - test_context - .event_handler_context - .event_handler - .push_event(Event::from(MetaEvent::ExternalCommandError)); - test_context.activate(&mut module, State::List); - assert_process_result!( - test_context.handle_event(&mut module), - event = Event::from(MetaEvent::ExternalCommandError) - ); - assert_external_editor_state_eq!( - module.state, - ExternalEditorState::Error(anyhow!("Editor returned a non-zero exit status")) - ); - let view_data = test_context.build_view_data(&mut module); - assert_rendered_output!( - view_data, - "{TITLE}", - "{LEADING}", - "{Normal}Editor returned a non-zero exit status", - "", - "{BODY}", - "{Normal}1) Abort rebase", - "{Normal}2) Edit rebase file", - "{Normal}3) Restore rebase file and abort edit", - "{Normal}4) Undo modifications and edit rebase file", - "", - "{IndicatorColor}Please choose an option." - ); - }, - ); + process_module_test(&["pick aaa comment"], &[], |mut test_context: TestContext<'_>| { + let mut module = ExternalEditor::new("editor"); + test_context + .event_handler_context + .event_handler + .push_event(Event::from(MetaEvent::ExternalCommandError)); + test_context.activate(&mut module, State::List); + assert_process_result!( + test_context.handle_event(&mut module), + event = Event::from(MetaEvent::ExternalCommandError) + ); + assert_external_editor_state_eq!( + module.state, + ExternalEditorState::Error(anyhow!("Editor returned a non-zero exit status")) + ); + let view_data = test_context.build_view_data(&mut module); + assert_rendered_output!( + view_data, + "{TITLE}", + "{LEADING}", + "{Normal}Editor returned a non-zero exit status", + "", + "{BODY}", + "{Normal}1) Abort rebase", + "{Normal}2) Edit rebase file", + "{Normal}3) Restore rebase file and abort edit", + "{Normal}4) Undo modifications and edit rebase file", + "", + "{IndicatorColor}Please choose an option." + ); + }); } #[test] fn editor_reload_error() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from(KeyCode::Up)], |mut test_context: TestContext<'_>| { let todo_path = test_context.get_todo_file_path(); @@ -387,7 +355,6 @@ fn editor_reload_error() { fn error_abort_rebase() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('1')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -407,7 +374,6 @@ fn error_abort_rebase() { fn error_edit_rebase() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('2')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -429,7 +395,6 @@ fn error_edit_rebase() { fn error_restore_and_abort() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('3')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); @@ -452,7 +417,6 @@ fn error_restore_and_abort() { fn error_undo_modifications_and_reedit() { process_module_test( &["pick aaa comment"], - ViewState::default(), &[Event::from('4')], |mut test_context: TestContext<'_>| { let mut module = ExternalEditor::new("editor"); diff --git a/src/insert/tests.rs b/src/insert/tests.rs index 164fee1..88b48d0 100644 --- a/src/insert/tests.rs +++ b/src/insert/tests.rs @@ -3,12 +3,12 @@ use crate::{ assert_process_result, assert_rendered_output, input::{Event, KeyCode}, - process::testutil::{process_module_test, TestContext, ViewState}, + process::testutil::{process_module_test, TestContext}, }; #[test] fn activate() { - process_module_test(&[], ViewState::default(), &[], |test_context: TestContext<'_>| { + process_module_test(&[], &[], |test_context: TestContext<'_>| { let mut module = Insert::new(); assert_process_result!(test_context.activate(&mut module, State::List)); }); @@ -16,7 +16,7 @@ fn activate() { #[test] fn render_prompt() { - process_module_test(&[], ViewState::default(), &[], |test_context: TestContext<'_>| { + process_module_test(&[], &[], |test_context: TestContext<'_>| { let mut module = Insert::new(); let view_data = test_context.build_view_data(&mut module); assert_rendered_output!( @@ -40,26 +40,20 @@ fn render_prompt() { #[test] fn prompt_cancel() { - process_module_test( - &[], - ViewState::default(), - &[Event::from('q')], - |mut test_context: TestContext<'_>| { - let mut module = Insert::new(); - assert_process_result!( - test_context.handle_event(&mut module), - event = Event::from('q'), - state = State::List - ); - }, - ); + process_module_test(&[], &[Event::from('q')], |mut test_context: TestContext<'_>| { + let mut module = Insert::new(); + assert_process_result!( + test_context.handle_event(&mut module), + event = Event::from('q'), + state = State::List + ); + }); } #[test] fn edit_render_exec() { process_module_test( &[], - ViewState::default(), &[ Event::from('e'), Event::from('f'), @@ -97,7 +91,6 @@ fn edit_render_exec() { fn edit_render_pick() { process_module_test( &[], - ViewState::default(), &[ Event::from('p'), Event::from('a'), @@ -138,7 +131,6 @@ fn edit_render_pick() { fn edit_render_label() { process_module_test( &[], - ViewState::default(), &[ Event::from('l'), Event::from('f'), @@ -178,7 +170,6 @@ fn edit_render_label() { fn edit_render_reset() { process_module_test( &[], - ViewState::default(), &[ Event::from('r'), Event::from('f'), @@ -218,7 +209,6 @@ fn edit_render_reset() { fn edit_render_merge() { process_module_test( &[], - ViewState::default(), &[ Event::from('m'), Event::from('f'), @@ -258,7 +248,6 @@ fn edit_render_merge() { fn edit_select_next_index() { process_module_test( &["pick aaa c1"], - ViewState::default(), &[ Event::from('e'), Event::from('f'), @@ -278,7 +267,6 @@ fn edit_select_next_index() { fn cancel_edit() { process_module_test( &[], - ViewState::default(), &[Event::from('e'), Event::from(KeyCode::Enter)], |mut test_context: TestContext<'_>| { let mut module = Insert::new(); diff --git a/src/list/tests.rs b/src/list/tests.rs index f38a8c3..57a72a4 100644 --- a/src/list/tests.rs +++ b/src/list/tests.rs @@ -3,14 +3,13 @@ use crate::{ assert_process_result, assert_render_action, assert_rendered_output, - display::size::Size, input::{KeyCode, KeyModifiers, MouseEvent, MouseEventKind}, - process::testutil::{process_module_test, TestContext, ViewState}, + process::testutil::{process_module_test, TestContext}, }; #[test] fn render_empty_list() { - process_module_test(&[], ViewState::default(), &[], |test_context: TestContext<'_>| { + process_module_test(&[], &[], |test_context: TestContext<'_>| { let mut module = List::new(test_context.config); let view_data = test_context.build_view_data(&mut module); assert_rendered_output!( @@ -39,7 +38,6 @@ fn render_full() { "reset ref", "merge command", ], - ViewState::default(), &[], |test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -83,9 +81,6 @@ fn render_compact() { "reset ref", "merge command", ], - ViewState { - size: Size::new(30, 100), - }, &[], |mut test_context: TestContext<'_>| { test_context.render_context.update(30, 300); @@ -116,7 +111,6 @@ fn render_compact() { fn move_cursor_down_1() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[Event::from(MetaEvent::MoveCursorDown)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -138,7 +132,6 @@ fn move_cursor_down_1() { fn move_cursor_down_view_end() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[Event::from(MetaEvent::MoveCursorDown); 2], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -160,7 +153,6 @@ fn move_cursor_down_view_end() { fn move_cursor_down_past_end() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[Event::from(MetaEvent::MoveCursorDown); 3], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -182,7 +174,6 @@ fn move_cursor_down_past_end() { fn move_cursor_down_scroll_bottom_move_up_one() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -208,7 +199,6 @@ fn move_cursor_down_scroll_bottom_move_up_one() { fn move_cursor_down_scroll_bottom_move_up_top() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorUp), @@ -234,9 +224,6 @@ fn move_cursor_down_scroll_bottom_move_up_top() { fn move_cursor_up_attempt_above_top() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::MoveCursorUp), Event::from(MetaEvent::MoveCursorUp), @@ -262,9 +249,6 @@ fn move_cursor_up_attempt_above_top() { fn move_cursor_down_attempt_below_bottom() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::MoveCursorDown); 4], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -287,9 +271,6 @@ fn move_cursor_down_attempt_below_bottom() { fn move_cursor_page_up_from_top() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::MoveCursorPageUp)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -313,7 +294,6 @@ fn move_cursor_page_up_from_top() { fn move_cursor_page_up_from_one_page_down() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -341,7 +321,6 @@ fn move_cursor_page_up_from_one_page_down() { fn move_cursor_page_up_from_one_page_down_minus_1() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -369,7 +348,6 @@ fn move_cursor_page_up_from_one_page_down_minus_1() { fn move_cursor_page_up_from_bottom() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -398,7 +376,6 @@ fn move_cursor_page_up_from_bottom() { fn move_cursor_home() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -425,7 +402,6 @@ fn move_cursor_home() { fn move_cursor_end() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[Event::from(MetaEvent::MoveCursorEnd)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -448,7 +424,6 @@ fn move_cursor_end() { fn move_cursor_page_down_past_bottom() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[Event::from(MetaEvent::MoveCursorPageDown); 3], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -472,7 +447,6 @@ fn move_cursor_page_down_past_bottom() { fn move_cursor_page_down_one_from_bottom() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -500,7 +474,6 @@ fn move_cursor_page_down_one_from_bottom() { fn move_cursor_page_down_one_page_from_bottom() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3", "pick aaa c4"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorPageDown), @@ -527,7 +500,6 @@ fn move_cursor_page_down_one_page_from_bottom() { fn mouse_scroll() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[ Event::Mouse(MouseEvent { kind: MouseEventKind::ScrollDown, @@ -568,9 +540,6 @@ fn mouse_scroll() { fn visual_mode_start() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ToggleVisualMode)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -592,9 +561,6 @@ fn visual_mode_start() { fn visual_mode_start_cursor_down_one() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::ToggleVisualMode), Event::from(MetaEvent::MoveCursorDown), @@ -626,9 +592,6 @@ fn visual_mode_start_cursor_page_down() { "pick aaa c4", "pick aaa c5", ], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::ToggleVisualMode), Event::from(MetaEvent::MoveCursorPageDown), @@ -664,9 +627,6 @@ fn visual_mode_start_cursor_from_bottom_move_up() { "pick aaa c4", "pick aaa c5", ], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -704,9 +664,6 @@ fn visual_mode_start_cursor_from_bottom_to_top() { "pick aaa c4", "pick aaa c5", ], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -744,9 +701,6 @@ fn visual_mode_start_cursor_from_bottom_to_top() { fn change_selected_line_to_drop() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionDrop)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -766,9 +720,6 @@ fn change_selected_line_to_drop() { fn change_selected_line_to_edit() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionEdit)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -788,9 +739,6 @@ fn change_selected_line_to_edit() { fn change_selected_line_to_fixup() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionFixup)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -810,9 +758,6 @@ fn change_selected_line_to_fixup() { fn change_selected_line_to_pick() { process_module_test( &["drop aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionPick)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -832,9 +777,6 @@ fn change_selected_line_to_pick() { fn change_selected_line_to_reword() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionReword)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -854,9 +796,6 @@ fn change_selected_line_to_reword() { fn change_selected_line_to_squash() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionSquash)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -876,9 +815,6 @@ fn change_selected_line_to_squash() { fn change_selected_line_toggle_break_add() { process_module_test( &["pick aaa c1"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionBreak)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -899,9 +835,6 @@ fn change_selected_line_toggle_break_add() { fn change_selected_line_toggle_break_remove() { process_module_test( &["pick aaa c1", "break"], - ViewState { - size: Size::new(120, 4), - }, &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::ActionBreak), @@ -924,9 +857,6 @@ fn change_selected_line_toggle_break_remove() { fn change_selected_line_toggle_break_above_existing() { process_module_test( &["pick aaa c1", "break"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionBreak)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -947,9 +877,6 @@ fn change_selected_line_toggle_break_above_existing() { fn change_selected_line_auto_select_next_with_next_line() { process_module_test( &["pick aaa c1", "pick aaa c2"], - ViewState { - size: Size::new(120, 4), - }, &[Event::from(MetaEvent::ActionSquash)], |mut test_context: TestContext<'_>| { let mut config = test_context.config.clone(); @@ -972,7 +899,6 @@ fn change_selected_line_auto_select_next_with_next_line() { fn change_selected_line_swap_down() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[Event::from(MetaEvent::SwapSelectedDown)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -994,7 +920,6 @@ fn change_selected_line_swap_down() { fn change_selected_line_swap_up() { process_module_test( &["pick aaa c1", "pick aaa c2", "pick aaa c3"], - ViewState::default(), &[ Event::from(MetaEvent::MoveCursorDown), Event::from(MetaEvent::MoveCursorDown), @@ -1020,7 +945,6 @@ fn change_selected_line_swap_up() { fn normal_mode_show_commit_when_hash_available() { process_module_test( &["pick aaa c1"], - ViewState::default(), &[Event::from(MetaEvent::ShowCommit)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -1037,7 +961,6 @@ fn normal_mode_show_commit_when_hash_available() { fn normal_mode_show_commit_when_no_selected_line() { process_module_test( &[], - ViewState::default(), &[Event::from(MetaEvent::ShowCommit)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -1053,7 +976,6 @@ fn normal_mode_show_commit_when_no_selected_line() { fn normal_mode_do_not_show_commit_when_hash_not_available() { process_module_test( &["exec echo foo"], - ViewState::default(), &[Event::from(MetaEvent::ShowCommit)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -1069,7 +991,6 @@ fn normal_mode_do_not_show_commit_when_hash_not_available() { fn normal_mode_abort() { process_module_test( &["pick aaa c1"], - ViewState::default(), &[Event::from(MetaEvent::Abort)], |mut test_context: TestContext<'_>| { let mut module = List::new(test_context.config); @@ -1086,7 +1007,6 @@ fn normal_mode_abort() { fn normal_mode_force_abort() |