aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/basic.rs
diff options
context:
space:
mode:
authorDenis Maximov <denismaximov98@gmail.com>2020-11-14 19:59:37 +0200
committerGitHub <noreply@github.com>2020-11-14 18:59:37 +0100
commita2914066bf0e2e2bf5caee263d2378b7d77f477f (patch)
tree2a87397c32e2d9f512ad0c886107aa5c2e57d68e /src/tests/integration/basic.rs
parentHOTFIX: do not get os input unless we're starting the app (diff)
downloadsl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.tar.gz
sl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.tar.xz
sl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.zip
feat: add rustfmt, update action workflow to check for formatting (#45)
Diffstat (limited to 'src/tests/integration/basic.rs')
-rw-r--r--src/tests/integration/basic.rs100
1 files changed, 56 insertions, 44 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
index a7e84ad0..6640b6e6 100644
--- a/src/tests/integration/basic.rs
+++ b/src/tests/integration/basic.rs
@@ -1,29 +1,20 @@
-use ::nix::pty::Winsize;
use ::insta::assert_snapshot;
+use ::nix::pty::Winsize;
-use crate::{start, Opt};
-use crate::tests::fakes::{FakeInputOutput};
-use crate::tests::utils::get_output_frame_snapshots;
+use crate::tests::fakes::FakeInputOutput;
use crate::tests::utils::commands::{
- SPLIT_HORIZONTALLY,
- SPLIT_VERTICALLY,
- RESIZE_UP,
- MOVE_FOCUS,
- RESIZE_LEFT,
- RESIZE_RIGHT,
- SPAWN_TERMINAL,
- QUIT,
- SCROLL_UP,
- SCROLL_DOWN,
- TOGGLE_ACTIVE_TERMINAL_FULLSCREEN,
+ MOVE_FOCUS, QUIT, RESIZE_LEFT, RESIZE_RIGHT, RESIZE_UP, SCROLL_DOWN, SCROLL_UP, SPAWN_TERMINAL,
+ SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN,
};
+use crate::tests::utils::get_output_frame_snapshots;
+use crate::{start, Opt};
-fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput {
+fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput {
FakeInputOutput::new(fake_win_size.clone())
}
#[test]
-pub fn starts_with_one_terminal () {
+pub fn starts_with_one_terminal() {
let fake_win_size = Winsize {
ws_col: 121,
ws_row: 20,
@@ -33,7 +24,11 @@ pub fn starts_with_one_terminal () {
let mut fake_input_output = get_fake_os_input(&fake_win_size);
fake_input_output.add_terminal_input(&[QUIT]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -49,12 +44,13 @@ pub fn split_terminals_vertically() {
ws_ypixel: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- SPLIT_VERTICALLY,
- QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, QUIT]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -70,12 +66,13 @@ pub fn split_terminals_horizontally() {
ws_ypixel: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- SPLIT_HORIZONTALLY,
- QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, QUIT]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -83,7 +80,7 @@ pub fn split_terminals_horizontally() {
}
#[test]
-pub fn split_largest_terminal () {
+pub fn split_largest_terminal() {
// this finds the largest pane and splits along its longest edge (vertically or horizontally)
let fake_win_size = Winsize {
ws_col: 121,
@@ -92,14 +89,13 @@ pub fn split_largest_terminal () {
ws_ypixel: 0,
};
let mut fake_input_output = get_fake_os_input(&fake_win_size);
- fake_input_output.add_terminal_input(&[
- SPAWN_TERMINAL,
- SPAWN_TERMINAL,
- SPAWN_TERMINAL,
- QUIT,
- ]);
+ fake_input_output.add_terminal_input(&[SPAWN_TERMINAL, SPAWN_TERMINAL, SPAWN_TERMINAL, QUIT]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -144,7 +140,11 @@ pub fn resize_right_and_up_on_the_same_axis() {
QUIT,
]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -170,7 +170,11 @@ pub fn scrolling_inside_a_pane() {
QUIT,
]);
start(Box::new(fake_input_output.clone()), Opt::default());
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -178,7 +182,7 @@ pub fn scrolling_inside_a_pane() {
}
#[test]
-pub fn max_panes () {
+pub fn max_panes() {
// with the --max-panes option, we only allow a certain amount of panes on screen
// simultaneously, new panes beyond this limit will close older panes on screen
let fake_win_size = Winsize {
@@ -193,12 +197,16 @@ pub fn max_panes () {
SPAWN_TERMINAL,
SPAWN_TERMINAL,
SPAWN_TERMINAL,
- QUIT
+ QUIT,
]);
let mut opts = Opt::default();
opts.max_panes = Some(4);
start(Box::new(fake_input_output.clone()), opts);
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);
@@ -206,7 +214,7 @@ pub fn max_panes () {
}
#[test]
-pub fn toggle_focused_pane_fullscreen () {
+pub fn toggle_focused_pane_fullscreen() {
let fake_win_size = Winsize {
ws_col: 121,
ws_row: 20,
@@ -229,12 +237,16 @@ pub fn toggle_focused_pane_fullscreen () {
MOVE_FOCUS,
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN,
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN,
- QUIT
+ QUIT,
]);
let mut opts = Opt::default();
opts.max_panes = Some(4);
start(Box::new(fake_input_output.clone()), opts);
- let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
for snapshot in snapshots {
assert_snapshot!(snapshot);