Apply deprecated_safe_2024

This commit is contained in:
Eric Huss 2025-07-05 20:17:36 -07:00
parent 639143579a
commit e24a9865ac

View File

@ -62,17 +62,23 @@ mod tests {
fn test_with_without() {
let olduserprofile = env::var_os("USERPROFILE").unwrap();
unsafe {
env::remove_var("HOME");
env::remove_var("USERPROFILE");
}
assert_eq!(home_dir_inner(), Some(PathBuf::from(olduserprofile)));
let home = Path::new(r"C:\Users\foo tar baz");
unsafe {
env::set_var("HOME", home.as_os_str());
}
assert_ne!(home_dir_inner().as_ref().map(Deref::deref), Some(home));
unsafe {
env::set_var("USERPROFILE", home.as_os_str());
}
assert_eq!(home_dir_inner().as_ref().map(Deref::deref), Some(home));
}
}