Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle/profile: Canonicalize during test
Merged lorenz opened 6 months ago

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"
1 file changed +3 -2 86b7ef23 60798cdb
modified crates/radicle/src/profile.rs
@@ -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(