mirror of
https://github.com/sharkdp/bat.git
synced 2024-12-25 15:58:51 +01:00
Add tests for --squeeze
This commit is contained in:
parent
6c2ce63101
commit
2323aa0def
30
tests/examples/empty_lines.txt
vendored
Normal file
30
tests/examples/empty_lines.txt
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
line 1
|
||||
|
||||
|
||||
|
||||
line 5
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
line 20
|
||||
line 21
|
||||
|
||||
|
||||
line 24
|
||||
|
||||
line 26
|
||||
|
||||
|
||||
|
||||
line 30
|
@ -208,6 +208,70 @@ fn line_range_multiple() {
|
||||
.stdout("line 1\nline 2\nline 4\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn squeeze() {
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("line 1\n\nline 5\n\nline 20\nline 21\n\nline 24\n\nline 26\n\nline 30\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn squeeze_line_numbers() {
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.arg("--decorations=always")
|
||||
.arg("--number")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(" 1 line 1\n 2 \n 5 line 5\n 6 \n 20 line 20\n 21 line 21\n 22 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 30 line 30\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn squeeze_limit() {
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.arg("--squeeze-limit=2")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("line 1\n\n\nline 5\n\n\nline 20\nline 21\n\n\nline 24\n\nline 26\n\n\nline 30\n");
|
||||
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.arg("--squeeze-limit=5")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("line 1\n\n\n\nline 5\n\n\n\n\n\nline 20\nline 21\n\n\nline 24\n\nline 26\n\n\n\nline 30\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn squeeze_limit_line_numbers() {
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.arg("--squeeze-limit=2")
|
||||
.arg("--decorations=always")
|
||||
.arg("--number")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(" 1 line 1\n 2 \n 3 \n 5 line 5\n 6 \n 7 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 30 line 30\n");
|
||||
|
||||
bat()
|
||||
.arg("empty_lines.txt")
|
||||
.arg("--squeeze")
|
||||
.arg("--squeeze-limit=5")
|
||||
.arg("--decorations=always")
|
||||
.arg("--number")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(" 1 line 1\n 2 \n 3 \n 4 \n 5 line 5\n 6 \n 7 \n 8 \n 9 \n 10 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 29 \n 30 line 30\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
|
||||
fn short_help() {
|
||||
|
Loading…
Reference in New Issue
Block a user