Path migration part 4: various tests (#13373)

# Description
Part 4 of replacing std::path types with nu_path types added in
https://github.com/nushell/nushell/pull/13115. This PR migrates various
tests throughout the code base.
This commit is contained in:
Ian Manske
2024-08-03 08:09:13 +00:00
committed by GitHub
parent 85b06b22d9
commit f4c0d9d45b
13 changed files with 213 additions and 212 deletions

View File

@ -1,9 +1,8 @@
use nu_path::Path;
use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
use std::path::PathBuf;
#[test]
fn expands_path_with_dot() {
Playground::setup("path_expand_1", |dirs, sandbox| {
@ -18,7 +17,7 @@ fn expands_path_with_dot() {
));
let expected = dirs.test.join("menu").join("spam.txt");
assert_eq!(PathBuf::from(actual.out), expected);
assert_eq!(Path::new(&actual.out), expected);
})
}
@ -38,7 +37,7 @@ fn expands_path_without_follow_symlink() {
));
let expected = dirs.test.join("menu").join("spam_link.ln");
assert_eq!(PathBuf::from(actual.out), expected);
assert_eq!(Path::new(&actual.out), expected);
})
}
@ -56,7 +55,7 @@ fn expands_path_with_double_dot() {
));
let expected = dirs.test.join("menu").join("spam.txt");
assert_eq!(PathBuf::from(actual.out), expected);
assert_eq!(Path::new(&actual.out), expected);
})
}
@ -74,7 +73,7 @@ fn const_path_expand() {
));
let expected = dirs.test.join("menu").join("spam.txt");
assert_eq!(PathBuf::from(actual.out), expected);
assert_eq!(Path::new(&actual.out), expected);
})
}
@ -92,7 +91,7 @@ mod windows {
"#
));
assert!(!PathBuf::from(actual.out).starts_with("~"));
assert!(!Path::new(&actual.out).starts_with("~"));
})
}
@ -106,7 +105,7 @@ mod windows {
"#
));
assert!(!PathBuf::from(actual.out).starts_with("~"));
assert!(!Path::new(&actual.out).starts_with("~"));
})
}
@ -131,7 +130,7 @@ mod windows {
));
let expected = dirs.test.join("menu").join("spam_link.ln");
assert_eq!(PathBuf::from(actual.out), expected);
assert_eq!(Path::new(&actual.out), expected);
})
}
}