aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2020-12-18 15:59:21 +0100
committerGitHub <noreply@github.com>2020-12-18 15:59:21 +0100
commit83a830e4abae63d83e55635088ff7ad0dc46a1c8 (patch)
treeaed39a0fdce5efadbf9f2424b0b463148bfa88c9 /src/tests
parentdocs(readme): update usage hotkeys (diff)
downloadsl0ppij-83a830e4abae63d83e55635088ff7ad0dc46a1c8.tar.gz
sl0ppij-83a830e4abae63d83e55635088ff7ad0dc46a1c8.tar.xz
sl0ppij-83a830e4abae63d83e55635088ff7ad0dc46a1c8.zip
fix(compatibility): fish multiline paste (#112)
* fix(compatibility): fix fish multiline paste * fix(tests): adjust snapshots of test to tabs * style(formatting): make rustfmt happy
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/fixtures/fish_paste_multilinebin0 -> 2395 bytes
-rw-r--r--src/tests/integration/compatibility.rs25
-rw-r--r--src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-2.snap32
-rw-r--r--src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-3.snap32
-rw-r--r--src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline.snap32
5 files changed, 121 insertions, 0 deletions
diff --git a/src/tests/fixtures/fish_paste_multiline b/src/tests/fixtures/fish_paste_multiline
new file mode 100644
index 00000000..f41187f6
--- /dev/null
+++ b/src/tests/fixtures/fish_paste_multiline
Binary files differ
diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs
index 65dc8da9..578e8fd2 100644
--- a/src/tests/integration/compatibility.rs
+++ b/src/tests/integration/compatibility.rs
@@ -388,3 +388,28 @@ pub fn bash_cursor_linewrap() {
assert_snapshot!(snapshot);
}
}
+
+#[test]
+pub fn fish_paste_multiline() {
+ // here we paste a multiline command in fish shell, making sure we support it
+ // going up and changing the colors of our line-wrapped pasted text
+ let fake_win_size = PositionAndSize {
+ columns: 149,
+ rows: 28,
+ x: 0,
+ y: 0,
+ };
+ let fixture_name = "fish_paste_multiline";
+ let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name);
+ fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]);
+ start(Box::new(fake_input_output.clone()), Opt::default());
+ 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);
+ }
+}
diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-2.snap
new file mode 100644
index 00000000..d1c18eb2
--- /dev/null
+++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-2.snap
@@ -0,0 +1,32 @@
+---
+source: src/tests/integration/compatibility.rs
+expression: snapshot
+---
+
+ OS: 5.9.14-arch1-1 GNU/Linux
+ Uptime: 12 hours, 21 minutes
+ Hostname: kingdom
+ Disk usage:
+
+df: /run/user/1000/doc: Operation not permitted
+ / 295G / 514G 61%
+ /efi 27M / 96M 28%
+
+ Network:
+
+ wlp2s0 192.168.0.3
+
+[I] [21:58] kingdom:mosaic (main) | echo -ne (\
+ df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
+ awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
+ sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\
+)$/\\\\e[0;33m\1\\\\e[0m/' | \
+)
+ paste -sd ''\
+ )█
+
+
+
+
+
+
diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-3.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-3.snap
new file mode 100644
index 00000000..a1cb439e
--- /dev/null
+++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline-3.snap
@@ -0,0 +1,32 @@
+---
+source: src/tests/integration/compatibility.rs
+expression: snapshot
+---
+ OS: 5.9.14-arch1-1 GNU/Linux
+ Uptime: 12 hours, 21 minutes
+ Hostname: kingdom
+ Disk usage:
+
+df: /run/user/1000/doc: Operation not permitted
+ / 295G / 514G 61%
+ /efi 27M / 96M 28%
+
+ Network:
+
+ wlp2s0 192.168.0.3
+
+[I] [21:58] kingdom:mosaic (main) | echo -ne (\
+ df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
+ awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
+ sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\
+)$/\\\\e[0;33m\1\\\\e[0m/' | \
+)
+ paste -sd ''\
+ )
+
+
+
+
+
+
+Bye from Mosaic!█
diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline.snap
new file mode 100644
index 00000000..739c38e6
--- /dev/null
+++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__fish_paste_multiline.snap
@@ -0,0 +1,32 @@
+---
+source: src/tests/integration/compatibility.rs
+expression: snapshot
+---
+█
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+