Fix accidental printing of files named 'cache'
This also adds two regression tests, so this will hopefully not pop up
again.
closes #557
commit72152296c79dc1e758bcd8c3111c0c3e475c4bbe
authorsharkdp <davidpeter@web.de>
dateFri 10 May 2019, 14:02 (8 years ago)
parent2b9d25d
Cargo.lock+2
@@ -1,3 +1,5 @@
1+# This file is automatically @generated by Cargo.
2+# It is not intended for manual editing.
13[[package]]
24name = "adler32"
35version = "1.0.3"
src/clap_app.rs−1
@@ -18,7 +18,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
1818 .global_setting(AppSettings::DeriveDisplayOrder)
1919 .global_setting(AppSettings::UnifiedHelpMessage)
2020 .global_setting(AppSettings::HidePossibleValuesInHelp)
21− .setting(AppSettings::InferSubcommands)
2221 .setting(AppSettings::ArgsNegateSubcommands)
2322 .setting(AppSettings::DisableHelpSubcommand)
2423 .setting(AppSettings::VersionlessSubcommands)
tests/examples/cachenew file+1
tests/integration_tests.rs+15
@@ -448,3 +448,18 @@ fn utf16() {
448448 .success()
449449 .stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap());
450450}
451+
452+#[test]
453+fn can_print_file_named_cache() {
454+ bat()
455+ .arg("cache")
456+ .assert()
457+ .success()
458+ .stdout("test\n")
459+ .stderr("");
460+}
461+
462+#[test]
463+fn does_not_print_unwanted_file_named_cache() {
464+ bat_with_config().arg("cach").assert().failure();
465+}