summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorReid Wagner <reid.ab.wagner@gmail.com>2019-02-07 19:27:48 -0800
committerDavid Peter <sharkdp@users.noreply.github.com>2019-02-08 23:30:33 +0100
commitcec9cc073c477c0a664415b846fd7f2518c69ee3 (patch)
tree3abde82f93cbfbc048959024b2cfbb88e6d90f39 /tests
parenta16789a060e4446f6b2345d487c02c6219070295 (diff)
Add integration tests running bat with empty input files.
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/empty.txt0
-rw-r--r--tests/integration_tests.rs52
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/examples/empty.txt b/tests/examples/empty.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/examples/empty.txt
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
@@ -77,6 +77,58 @@ fn concatenate_stdin() {
}
#[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()
.arg("multiline.txt")