From cec9cc073c477c0a664415b846fd7f2518c69ee3 Mon Sep 17 00:00:00 2001 From: Reid Wagner Date: Thu, 7 Feb 2019 19:27:48 -0800 Subject: [PATCH] Add integration tests running bat with empty input files. --- tests/examples/empty.txt | 0 tests/integration_tests.rs | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/examples/empty.txt diff --git a/tests/examples/empty.txt b/tests/examples/empty.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 3102cb13..72499ea9 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -76,6 +76,58 @@ fn concatenate_stdin() { .stdout("hello world\nstdin\nhello world\n"); } +#[test] +fn concatenate_empty_first() { + bat() + .arg("empty.txt") + .arg("test.txt") + .assert() + .success() + .stdout("hello world\n"); +} + +#[test] +fn concatenate_empty_last() { + bat() + .arg("test.txt") + .arg("empty.txt") + .assert() + .success() + .stdout("hello world\n"); +} + +#[test] +fn concatenate_empty_both() { + bat() + .arg("empty.txt") + .arg("empty.txt") + .assert() + .success() + .stdout(""); +} + +#[test] +fn concatenate_empty_between() { + bat() + .arg("test.txt") + .arg("empty.txt") + .arg("test.txt") + .assert() + .success() + .stdout("hello world\nhello world\n"); +} + +#[test] +fn concatenate_empty_first_and_last() { + bat() + .arg("empty.txt") + .arg("test.txt") + .arg("empty.txt") + .assert() + .success() + .stdout("hello world\n"); +} + #[test] fn line_numbers() { bat()