parent
25ef603990
commit
5964fc192c
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3302,6 +3302,7 @@ dependencies = [
|
|||
"open",
|
||||
"percent-encoding",
|
||||
"relative-path",
|
||||
"same-file",
|
||||
"serde_json",
|
||||
"site",
|
||||
"termcolor",
|
||||
|
|
|
@ -45,6 +45,9 @@ errors = { path = "components/errors" }
|
|||
front_matter = { path = "components/front_matter" }
|
||||
utils = { path = "components/utils" }
|
||||
|
||||
[dev-dependencies]
|
||||
same-file = "1"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"components/config",
|
||||
|
|
|
@ -250,16 +250,15 @@ mod tests {
|
|||
#[test]
|
||||
fn strip_unc_test() {
|
||||
let mut dir = temp_dir();
|
||||
dir.push("new_project");
|
||||
dir.push("new_project1");
|
||||
if dir.exists() {
|
||||
remove_dir_all(&dir).expect("Could not free test directory");
|
||||
}
|
||||
create_dir(&dir).expect("Could not create test directory");
|
||||
if cfg!(target_os = "windows") {
|
||||
assert_eq!(
|
||||
strip_unc(&canonicalize(Path::new(&dir)).unwrap()),
|
||||
"C:\\Users\\VssAdministrator\\AppData\\Local\\Temp\\new_project"
|
||||
)
|
||||
let stripped_path = strip_unc(&canonicalize(Path::new(&dir)).unwrap());
|
||||
assert!(same_file::is_same_file(Path::new(&stripped_path),&dir).unwrap());
|
||||
assert!(!stripped_path.starts_with(LOCAL_UNC),"The path was not stripped.");
|
||||
} else {
|
||||
assert_eq!(
|
||||
strip_unc(&canonicalize(Path::new(&dir)).unwrap()),
|
||||
|
@ -277,15 +276,15 @@ mod tests {
|
|||
#[cfg(target_os = "windows")]
|
||||
fn strip_unc_required_test() {
|
||||
let mut dir = temp_dir();
|
||||
dir.push("new_project");
|
||||
dir.push("new_project2");
|
||||
if dir.exists() {
|
||||
remove_dir_all(&dir).expect("Could not free test directory");
|
||||
}
|
||||
create_dir(&dir).expect("Could not create test directory");
|
||||
assert_eq!(
|
||||
canonicalize(Path::new(&dir)).unwrap().to_str().unwrap(),
|
||||
"\\\\?\\C:\\Users\\VssAdministrator\\AppData\\Local\\Temp\\new_project"
|
||||
);
|
||||
|
||||
let canonicalized_path = canonicalize(Path::new(&dir)).unwrap();
|
||||
assert!(same_file::is_same_file(Path::new(&canonicalized_path),&dir).unwrap());
|
||||
assert!(canonicalized_path.to_str().unwrap().starts_with(LOCAL_UNC));
|
||||
|
||||
remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue