summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Isidoro <denisidoro@users.noreply.github.com>2022-05-15 12:06:33 -0300
committerGitHub <noreply@github.com>2022-05-15 12:06:33 -0300
commit7e297fc2b57667ddb583d3cd6ab7ea165a0ba73c (patch)
tree1abeb06892a16e3a1a9fa2457c2971a8855b2f48 /src
parent67d6a6a27fcf24ace20c28fcb0358fac29deeecf (diff)
Fix path-related tests (#727)
Diffstat (limited to 'src')
-rw-r--r--src/filesystem.rs30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/filesystem.rs b/src/filesystem.rs
index 85b8c62..d6e9dc8 100644
--- a/src/filesystem.rs
+++ b/src/filesystem.rs
@@ -281,16 +281,17 @@ mod tests {
let base_dirs = BaseDirs::new()
.ok_or(anyhow!("bad"))
.expect("could not determine base directories");
- let mut expect = base_dirs.config_dir().to_path_buf();
- expect.push("navi");
- expect.push("config.yaml");
- let expect = match option_env!("NAVI_CONFIG") {
- Some(path) => path.to_string(),
- None => expect.to_string_lossy().to_string(),
+
+ let expected = {
+ let mut e = base_dirs.config_dir().to_path_buf();
+ e.push("navi");
+ e.push("config.yaml");
+ e.to_string_lossy().to_string()
};
+
let config = default_config_pathbuf().expect("could not find default config path");
- assert_eq!(expect, config.to_string_lossy().to_string())
+ assert_eq!(expected, config.to_string_lossy().to_string())
}
#[test]
@@ -298,15 +299,16 @@ mod tests {
let base_dirs = BaseDirs::new()
.ok_or(anyhow!("bad"))
.expect("could not determine base directories");
- let mut expect = base_dirs.data_dir().to_path_buf();
- expect.push("navi");
- expect.push("cheats");
- let expect = match option_env!("NAVI_PATH") {
- Some(path) => path.to_string(),
- None => expect.to_string_lossy().to_string(),
+
+ let expected = {
+ let mut e = base_dirs.data_dir().to_path_buf();
+ e.push("navi");
+ e.push("cheats");
+ e.to_string_lossy().to_string()
};
+
let cheats = default_cheat_pathbuf().expect("could not find default config path");
- assert_eq!(expect, cheats.to_string_lossy().to_string())
+ assert_eq!(expected, cheats.to_string_lossy().to_string())
}
}