diff options
author | Kyle Criddle <criddle.kyle@gmail.com> | 2020-03-19 20:46:19 -0600 |
---|---|---|
committer | Kyle Criddle <criddle.kyle@gmail.com> | 2020-03-19 20:46:19 -0600 |
commit | cfa2cb6ec77f8faaab134c296350b982ff1ffe40 (patch) | |
tree | bf8c6a765cf39320d8ea4870bb0f18081172e38d /tests | |
parent | 517be5c7bcb034bda56ba8572f2e5f103163bf58 (diff) |
--file-name for normal files. integration tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/test.binary | bin | 0 -> 4 bytes | |||
-rw-r--r-- | tests/integration_tests.rs | 57 |
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/examples/test.binary b/tests/examples/test.binary Binary files differnew file mode 100644 index 00000000..593f4708 --- /dev/null +++ b/tests/examples/test.binary diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 0d5f4a3c..f2722339 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -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(""); +} |