aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-04-04 18:03:24 +0200
committera-kenji <aks.kenji@protonmail.com>2021-04-04 18:06:12 +0200
commitca014d7aaced18c534c5a3577906922db0a58e75 (patch)
treed97691b3da374f686ffee911084081c09366b255
parentChore(rustfmt) (diff)
downloadsl0ppij-ca014d7aaced18c534c5a3577906922db0a58e75.tar.gz
sl0ppij-ca014d7aaced18c534c5a3577906922db0a58e75.tar.xz
sl0ppij-ca014d7aaced18c534c5a3577906922db0a58e75.zip
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.
-rw-r--r--src/common/input/config.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/input/config.rs b/src/common/input/config.rs
index 0713e54e..4bb9e10f 100644
--- a/src/common/input/config.rs
+++ b/src/common/input/config.rs
@@ -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 {