From f9980f720538a62ef654b5b1ab5296663a77c6c3 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 21 Mar 2023 15:30:41 +0100 Subject: [PATCH] radicle: Fix `canonicalize_home` test on macos Signed-off-by: Sebastian Martinez --- radicle/src/profile.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/radicle/src/profile.rs b/radicle/src/profile.rs index de763d33..1aabdaf1 100644 --- a/radicle/src/profile.rs +++ b/radicle/src/profile.rs @@ -227,6 +227,7 @@ impl Home { #[cfg(test)] mod test { use std::fs; + use std::path::Path; use super::Home; @@ -242,7 +243,7 @@ mod test { fs::create_dir_all(path.clone()).unwrap(); let last = tmp.path().components().last().unwrap(); - let home = Home::new( + let mut home = Home::new( tmp.path() .join("..") .join(last) @@ -250,6 +251,11 @@ mod test { .join("Radicle"), ) .unwrap(); + if cfg!(target_os = "macos") { + home.path = + Path::new("/").join(home.path.strip_prefix("/private").unwrap_or(&home.path)) + }; + assert_eq!(home.path, path); } }