aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/resize_down.rs
diff options
context:
space:
mode:
authorYutaka Kamei <kamei@yykamei.me>2021-04-30 23:35:12 +0900
committerYutaka Kamei <kamei@yykamei.me>2021-05-02 06:18:40 +0900
commit168deabea7825f1b2bf81ec79de9f4bfaab8413e (patch)
treedd413499bb1a77d1af25705217bfab86ce2f18b4 /src/tests/integration/resize_down.rs
parentDon't commit to master like an idiot... :( (diff)
downloadsl0ppij-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_down.rs')
-rw-r--r--src/tests/integration/resize_down.rs79
1 files changed, 66 insertions, 13 deletions
diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs
index 68f8bb41..d5ad4ef8 100644
--- a/src/tests/integration/resize_down.rs
+++ b/src/tests/integration/resize_down.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_DOWN_IN_RESIZE_MODE,
RESIZE_LEFT_IN_RESIZE_MODE, RESIZE_MODE, SLEEP, SPLIT_DOWN_IN_PANE_MODE,
@@ -42,7 +43,11 @@ pub fn resize_down_with_pane_above() {
&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
@@ -82,7 +87,11 @@ pub fn resize_down_with_pane_below() {
&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
@@ -128,7 +137,11 @@ pub fn resize_down_with_panes_above_and_below() {
&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
@@ -173,7 +186,11 @@ pub fn resize_down_with_multiple_panes_above() {
&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
@@ -220,7 +237,11 @@ pub fn resize_down_with_panes_above_aligned_left_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
@@ -266,7 +287,11 @@ pub fn resize_down_with_panes_below_aligned_left_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
@@ -310,7 +335,11 @@ pub fn resize_down_with_panes_above_aligned_right_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
@@ -355,7 +384,11 @@ pub fn resize_down_with_panes_below_aligned_right_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
@@ -403,7 +436,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_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
@@ -453,7 +490,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_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
@@ -520,7 +561,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef
&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
@@ -589,7 +634,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_
&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
@@ -626,7 +675,11 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() {
&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