Make path::canonicalize::canonicalize_dot test case more reliable (#6141)

Fixes #6139

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2022-07-27 16:30:03 +08:00 committed by GitHub
parent c8adb06ca7
commit b67fe31544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,22 +96,20 @@ fn canonicalize_absolute_path_relative_to() {
#[test]
fn canonicalize_dot() {
let cwd = std::env::current_dir().expect("Could not get current directory");
let actual = canonicalize_with(".", cwd).expect("Failed to canonicalize");
let expected = std::env::current_dir().expect("Could not get current directory");
let actual = canonicalize_with(".", expected.as_path()).expect("Failed to canonicalize");
assert_eq!(actual, expected);
}
#[test]
fn canonicalize_many_dots() {
let cwd = std::env::current_dir().expect("Could not get current directory");
let actual =
canonicalize_with("././/.//////./././//.///", cwd).expect("Failed to canonicalize");
let expected = std::env::current_dir().expect("Could not get current directory");
let actual = canonicalize_with("././/.//////./././//.///", expected.as_path())
.expect("Failed to canonicalize");
assert_eq!(actual, expected);
}