Skip to content

Commit

Permalink
Fix accidental printing of files named 'cache'
Browse files Browse the repository at this point in the history
This also adds two regression tests, so this will hopefully not pop up
again.

closes #557
  • Loading branch information
sharkdp committed May 10, 2019
1 parent 1ce0bc8 commit 6c636fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.global_setting(AppSettings::DeriveDisplayOrder)
.global_setting(AppSettings::UnifiedHelpMessage)
.global_setting(AppSettings::HidePossibleValuesInHelp)
.setting(AppSettings::InferSubcommands)
.setting(AppSettings::ArgsNegateSubcommands)
.setting(AppSettings::DisableHelpSubcommand)
.setting(AppSettings::VersionlessSubcommands)
Expand Down
1 change: 1 addition & 0 deletions tests/examples/cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
15 changes: 15 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 6c636fc

Please sign in to comment.