mirror of
https://github.com/denisidoro/navi
synced 2025-02-16 12:38:28 +00:00
Fix path-related tests (#727)
This commit is contained in:
parent
67d6a6a27f
commit
7e297fc2b5
1 changed files with 16 additions and 14 deletions
|
@ -281,16 +281,17 @@ mod tests {
|
||||||
let base_dirs = BaseDirs::new()
|
let base_dirs = BaseDirs::new()
|
||||||
.ok_or(anyhow!("bad"))
|
.ok_or(anyhow!("bad"))
|
||||||
.expect("could not determine base directories");
|
.expect("could not determine base directories");
|
||||||
let mut expect = base_dirs.config_dir().to_path_buf();
|
|
||||||
expect.push("navi");
|
let expected = {
|
||||||
expect.push("config.yaml");
|
let mut e = base_dirs.config_dir().to_path_buf();
|
||||||
let expect = match option_env!("NAVI_CONFIG") {
|
e.push("navi");
|
||||||
Some(path) => path.to_string(),
|
e.push("config.yaml");
|
||||||
None => expect.to_string_lossy().to_string(),
|
e.to_string_lossy().to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
let config = default_config_pathbuf().expect("could not find default config path");
|
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]
|
#[test]
|
||||||
|
@ -298,15 +299,16 @@ mod tests {
|
||||||
let base_dirs = BaseDirs::new()
|
let base_dirs = BaseDirs::new()
|
||||||
.ok_or(anyhow!("bad"))
|
.ok_or(anyhow!("bad"))
|
||||||
.expect("could not determine base directories");
|
.expect("could not determine base directories");
|
||||||
let mut expect = base_dirs.data_dir().to_path_buf();
|
|
||||||
expect.push("navi");
|
let expected = {
|
||||||
expect.push("cheats");
|
let mut e = base_dirs.data_dir().to_path_buf();
|
||||||
let expect = match option_env!("NAVI_PATH") {
|
e.push("navi");
|
||||||
Some(path) => path.to_string(),
|
e.push("cheats");
|
||||||
None => expect.to_string_lossy().to_string(),
|
e.to_string_lossy().to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
let cheats = default_cheat_pathbuf().expect("could not find default config path");
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue