radicle/profile: Canonicalize during test
Fixes test `profile::test::canonicalize_home`.
Since `Home::new` canonicalizes its argument (which is what the test
wants to ensure), also canonicalize the expected value, which is
especially important on Windows as the canonicalization is more
complex than on Linux.
For example:
thread 'profile::test::canonicalize_home' panicked at crates\radicle\src\profile.rs:802:9:
assertion `left == right` failed
left: "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\.tmpMnNkr6\\Home\\Radicle"
right: "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\.tmpMnNkr6\\Home\\Radicle"
This commit is contained in:
parent
86b7ef23c6
commit
60798cdbc3
|
|
@ -779,15 +779,16 @@ mod test {
|
|||
use super::*;
|
||||
|
||||
// Checks that if we have:
|
||||
// '/run/user/1000/.tmpqfK6ih/../.tmpqfK6ih/Radicle/Home'
|
||||
// '/run/user/1000/.tmpqfK6ih/../.tmpqfK6ih/Home/Radicle'
|
||||
//
|
||||
// that it gets normalized to:
|
||||
// '/run/user/1000/.tmpqfK6ih/Radicle/Home'
|
||||
// '/run/user/1000/.tmpqfK6ih/Home/Radicle'
|
||||
#[test]
|
||||
fn canonicalize_home() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let path = tmp.path().join("Home").join("Radicle");
|
||||
fs::create_dir_all(path.clone()).unwrap();
|
||||
let path = dunce::canonicalize(path).unwrap();
|
||||
|
||||
let last = tmp.path().components().next_back().unwrap();
|
||||
let home = Home::new(
|
||||
|
|
|
|||
Loading…
Reference in New Issue