Use Default Configuration for Tests

Uses the default configuration for tests,
in order to not mess up test cases with
different configurations in the config file.
This commit is contained in:
a-kenji 2021-04-04 18:03:24 +02:00
parent a4430bf158
commit ca014d7aac

View file

@ -79,6 +79,7 @@ impl Config {
}
/// Entry point of the configuration
#[cfg(not(test))]
pub fn from_cli_config(cli_config: Option<ConfigCli>) -> ConfigResult {
match cli_config {
Some(ConfigCli::Config { clean, .. }) if clean => Ok(Config::default()),
@ -88,6 +89,13 @@ impl Config {
Some(_) | None => Ok(Config::from_default_path()?),
}
}
//#[allow(unused_must_use)]
/// In order not to mess up tests from changing configurations
#[cfg(test)]
pub fn from_cli_config(_: Option<ConfigCli>) -> ConfigResult {
Ok(Config::default())
}
}
impl Display for ConfigError {