feat(config): added recognition of $BAT_CONFIG_DIR

This commit is contained in:
Bill Risher
2021-08-12 17:08:13 -05:00
committed by David Peter
parent f8498b260b
commit bf78288e9e
3 changed files with 39 additions and 11 deletions

View File

@ -747,6 +747,25 @@ fn config_location_when_generating() {
assert!(tmp_config_path.exists());
}
#[test]
fn config_location_from_bat_config_dir_variable() {
let bat_conf_dir = tempdir().expect("can't create temporary directory.").path().join("bat_conf_dir/");
// Create file at BAT_CONFIG_DIR
bat_with_config()
.env("BAT_CONFIG_DIR", bat_conf_dir.to_str().unwrap())
.arg("--generate-config-file")
.assert()
.success()
.stdout(
predicate::str::is_match("Success! Config file written to .*config\n")
.unwrap()
);
// Ensure generated config file exists.
assert!(bat_conf_dir.join("config").exists());
}
#[test]
fn config_read_arguments_from_file() {
bat_with_config()