aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-02 19:26:17 +0200
committerGitHub <noreply@github.com>2021-05-02 19:26:17 +0200
commitbf6386f4954ffa73225ef18cc02f087509f28765 (patch)
treeb016902cd4771ce5b4d86da7771e832c72c150c4 /src/common
parentdocs(changelog): Add theme support through xrdb #239 (diff)
parentEnables the Default Config Test (diff)
downloadsl0ppij-bf6386f4954ffa73225ef18cc02f087509f28765.tar.gz
sl0ppij-bf6386f4954ffa73225ef18cc02f087509f28765.tar.xz
sl0ppij-bf6386f4954ffa73225ef18cc02f087509f28765.zip
Merge pull request #436 from a-kenji/fix-default-config-test
Enables the Default Config Test
Diffstat (limited to 'src/common')
-rw-r--r--src/common/input/config.rs14
-rw-r--r--src/common/setup.rs6
2 files changed, 12 insertions, 8 deletions
diff --git a/src/common/input/config.rs b/src/common/input/config.rs
index 81c04120..3263b571 100644
--- a/src/common/input/config.rs
+++ b/src/common/input/config.rs
@@ -199,12 +199,10 @@ mod config_test {
assert_eq!(result.unwrap(), Config::default());
}
- // This test needs a split somewhere between test and normal runs,
- // since otherwise it would look in a local configuration and fail.
- //#[test]
- //fn try_from_cli_args_default() {
- //let opts = CliArgs::default();
- //let result = Config::try_from(&opts);
- //assert_eq!(result.unwrap(), Config::default());
- //}
+ #[test]
+ fn try_from_cli_args_default() {
+ let opts = CliArgs::default();
+ let result = Config::try_from(&opts);
+ assert_eq!(result.unwrap(), Config::default());
+ }
}
diff --git a/src/common/setup.rs b/src/common/setup.rs
index 9d1e7d19..70e0ded4 100644
--- a/src/common/setup.rs
+++ b/src/common/setup.rs
@@ -48,6 +48,7 @@ pub mod install {
}
}
+#[cfg(not(test))]
pub fn find_default_config_dir() -> Option<PathBuf> {
vec![
Some(xdg_config_dir()),
@@ -60,6 +61,11 @@ pub fn find_default_config_dir() -> Option<PathBuf> {
.flatten()
}
+#[cfg(test)]
+pub fn find_default_config_dir() -> Option<PathBuf> {
+ None
+}
+
pub fn xdg_config_dir() -> PathBuf {
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
project_dirs.config_dir().to_owned()