summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2019-05-10 14:02:08 -0500
committerDavid Peter <sharkdp@users.noreply.github.com>2019-05-10 17:55:46 -0500
commit72152296c79dc1e758bcd8c3111c0c3e475c4bbe (patch)
tree6676365c55e0d0590a2e8a4e4effa8e263eb5e16 /tests
parent2b9d25df052e50c60531b1000703b79bf9b6065a (diff)
Fix accidental printing of files named 'cache'
This also adds two regression tests, so this will hopefully not pop up again. closes #557
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/cache1
-rw-r--r--tests/integration_tests.rs15
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/examples/cache b/tests/examples/cache
new file mode 100644
index 00000000..9daeafb9
--- /dev/null
+++ b/tests/examples/cache
@@ -0,0 +1 @@
+test
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 7d9856ac..ec1ffd3f 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -448,3 +448,18 @@ fn utf16() {
.success()
.stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap());
}
+
+#[test]
+fn can_print_file_named_cache() {
+ bat()
+ .arg("cache")
+ .assert()
+ .success()
+ .stdout("test\n")
+ .stderr("");
+}
+
+#[test]
+fn does_not_print_unwanted_file_named_cache() {
+ bat_with_config().arg("cach").assert().failure();
+}