mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-02 19:32:25 +01:00
Merge pull request #1276 from tommilligan/style-rule
style: add component 'rule' for horizontal file delimiter
This commit is contained in:
@@ -580,6 +580,18 @@ fn empty_file_leads_to_empty_output_with_grid_enabled() {
|
||||
.stdout("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_file_leads_to_empty_output_with_rule_enabled() {
|
||||
bat()
|
||||
.arg("empty.txt")
|
||||
.arg("--style=rule")
|
||||
.arg("--decorations=always")
|
||||
.arg("--terminal-width=80")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filename_basic() {
|
||||
bat()
|
||||
@@ -678,6 +690,48 @@ fn header_padding() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_padding_rule() {
|
||||
bat()
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header,rule")
|
||||
.arg("--terminal-width=80")
|
||||
.arg("test.txt")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.stdout(
|
||||
"File: test.txt
|
||||
hello world
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
File: single-line.txt
|
||||
Single Line
|
||||
",
|
||||
)
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grid_overrides_rule() {
|
||||
bat()
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=grid,rule")
|
||||
.arg("--terminal-width=80")
|
||||
.arg("test.txt")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.stdout(
|
||||
"\
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
hello world
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
Single Line
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
",
|
||||
)
|
||||
.stderr("\x1b[33m[bat warning]\x1b[0m: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.\n");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn file_with_invalid_utf8_filename() {
|
||||
|
Reference in New Issue
Block a user