From ca014d7aaced18c534c5a3577906922db0a58e75 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Sun, 4 Apr 2021 18:03:24 +0200 Subject: [PATCH] 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. --- src/common/input/config.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -> 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) -> ConfigResult { + Ok(Config::default()) + } } impl Display for ConfigError {