mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-09 23:57:48 +02:00
--file-name for normal files. integration tests.
This commit is contained in:
@ -541,3 +541,60 @@ fn empty_file_leads_to_empty_output_with_grid_enabled() {
|
||||
.success()
|
||||
.stdout("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filename_basic() {
|
||||
bat()
|
||||
.arg("test.txt")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header")
|
||||
.arg("-r=0:0")
|
||||
.arg("--file-name=foo")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("File: foo\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filename_binary() {
|
||||
bat()
|
||||
.arg("test.binary")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header")
|
||||
.arg("-r=0:0")
|
||||
.arg("--file-name=foo")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("File: foo <BINARY>\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filename_stdin() {
|
||||
bat()
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header")
|
||||
.arg("-r=0:0")
|
||||
.arg("-")
|
||||
.write_stdin("stdin\n")
|
||||
.arg("--file-name=foo")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("File: foo\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filename_stdin_binary() {
|
||||
let vec = vec![0; 1];
|
||||
bat_with_config()
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header")
|
||||
.write_stdin(vec)
|
||||
.arg("--file-name=foo")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("File: foo <BINARY>\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
Reference in New Issue
Block a user