diff options
| author | Yutaka Kamei <kamei@yykamei.me> | 2021-04-30 23:35:12 +0900 |
|---|---|---|
| committer | Yutaka Kamei <kamei@yykamei.me> | 2021-05-02 06:18:40 +0900 |
| commit | 168deabea7825f1b2bf81ec79de9f4bfaab8413e (patch) | |
| tree | dd413499bb1a77d1af25705217bfab86ce2f18b4 /src/tests/integration/tabs.rs | |
| parent | Don't commit to master like an idiot... :( (diff) | |
| download | sl0ppij-168deabea7825f1b2bf81ec79de9f4bfaab8413e.tar.gz sl0ppij-168deabea7825f1b2bf81ec79de9f4bfaab8413e.tar.xz sl0ppij-168deabea7825f1b2bf81ec79de9f4bfaab8413e.zip | |
Load config before start()
Previously, a config file was loaded within `start()`, and if the config
file is invalid, Zellij was supposed to show a user what's wrong with
it. However, since `start()` starts setting up its terminal with an
alternative screen buffer, neither standard output nor standard error
could display such an error.
This change intends to address this issue by making Zellij load a config
file before `start()`.
In addition, the patch also includes some refactorings:
* Redefine `from_cli_config` with `TryFrom`, which was introduced in
Rust 1.34
* Remove conditional declaration `cfg(not(test))` because `start()` now
receive a `Config` as the third argument
* Introduce [`tempfile`](https://crates.io/crates/tempfile) in order to
run tests with actual files
* Typo?: "Deserialisation" -> "Deserialization"
Diffstat (limited to 'src/tests/integration/tabs.rs')
| -rw-r--r-- | src/tests/integration/tabs.rs | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/src/tests/integration/tabs.rs b/src/tests/integration/tabs.rs index 183b1b2a..f62ad0c4 100644 --- a/src/tests/integration/tabs.rs +++ b/src/tests/integration/tabs.rs @@ -5,6 +5,7 @@ use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots} use crate::{panes::PositionAndSize, tests::utils::commands::CLOSE_PANE_IN_PANE_MODE}; use crate::{start, CliArgs}; +use crate::common::input::config::Config; use crate::tests::utils::commands::{ CLOSE_TAB_IN_TAB_MODE, NEW_TAB_IN_TAB_MODE, PANE_MODE, QUIT, SPLIT_DOWN_IN_PANE_MODE, SWITCH_NEXT_TAB_IN_TAB_MODE, SWITCH_PREV_TAB_IN_TAB_MODE, TAB_MODE, @@ -32,7 +33,11 @@ pub fn open_new_tab() { &NEW_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -63,7 +68,11 @@ pub fn switch_to_prev_tab() { &SWITCH_PREV_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -94,7 +103,11 @@ pub fn switch_to_next_tab() { &SWITCH_NEXT_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -125,7 +138,11 @@ pub fn close_tab() { &CLOSE_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -157,7 +174,11 @@ pub fn close_last_pane_in_a_tab() { &CLOSE_PANE_IN_PANE_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -191,7 +212,11 @@ pub fn close_the_middle_tab() { &CLOSE_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -230,7 +255,11 @@ pub fn close_the_tab_that_has_a_pane_in_fullscreen() { &CLOSE_TAB_IN_TAB_MODE, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer @@ -261,7 +290,11 @@ pub fn closing_last_tab_exits_the_app() { &CLOSE_TAB_IN_TAB_MODE, &CLOSE_TAB_IN_TAB_MODE, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default()); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Config::default(), + ); let output_frames = fake_input_output .stdout_writer |
