Skip to content

Commit 859caac

Browse files
committed
fixed unit tests on windows
1 parent 68d79b3 commit 859caac

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/dotfiles.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,12 @@ pub fn get_potential_dotfiles_paths(profile: Option<String>) -> PotentialDotfile
347347
config: dirs::config_dir().unwrap().join(dotfiles_dir),
348348
env: std::env::var("TUCKR_HOME").map(PathBuf::from).ok(),
349349
test: std::env::temp_dir()
350-
.join(format!("tuckr-{}", std::thread::current().name().unwrap()))
350+
.join(format!(
351+
"tuckr-{}",
352+
// this will return a namespace but `::` is invalid on paths in windows
353+
// so we need to change it to prevent panics when interacting with the file system there
354+
std::thread::current().name().unwrap().replace("::", "_")
355+
))
351356
.join("dotfiles"),
352357
}
353358
}

src/fileops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ mod tests {
776776

777777
let target_dir = dirs::home_dir().unwrap().join(format!(
778778
"tuckr_test-{}",
779-
std::thread::current().name().unwrap()
779+
std::thread::current().name().unwrap().replace("::", "_")
780780
));
781781
fs::create_dir_all(&target_dir).unwrap();
782782

src/symlinks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ fn get_nonexistent_groups_with_no_related_groups(
552552

553553
Some(nonexistent_groups)
554554
}
555+
555556
/// Adds symlinks
556557
#[allow(clippy::too_many_arguments)]
557558
pub fn add_cmd(

0 commit comments

Comments
 (0)