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/resize_right.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/resize_right.rs')
| -rw-r--r-- | src/tests/integration/resize_right.rs | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs index 9545cac9..3f242f5a 100644 --- a/src/tests/integration/resize_right.rs +++ b/src/tests/integration/resize_right.rs @@ -5,6 +5,7 @@ use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots}; use crate::{start, CliArgs}; +use crate::common::input::config::Config; use crate::tests::utils::commands::{ MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_MODE, RESIZE_RIGHT_IN_RESIZE_MODE, RESIZE_UP_IN_RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE, @@ -38,7 +39,11 @@ pub fn resize_right_with_pane_to_the_left() { &SLEEP, &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 @@ -76,7 +81,11 @@ pub fn resize_right_with_pane_to_the_right() { &SLEEP, &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 @@ -116,7 +125,11 @@ pub fn resize_right_with_panes_to_the_left_and_right() { &SLEEP, &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 @@ -159,7 +172,11 @@ pub fn resize_right_with_multiple_panes_to_the_left() { &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 @@ -204,7 +221,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { &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 @@ -246,7 +267,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { &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 @@ -290,7 +315,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { &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 @@ -333,7 +362,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { &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 @@ -381,7 +414,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p &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 @@ -431,7 +468,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ &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 @@ -498,7 +539,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo &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 @@ -567,7 +612,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab &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 @@ -604,7 +653,11 @@ pub fn cannot_resize_right_when_pane_to_the_left_is_at_minimum_width() { &SLEEP, &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 |
