From b67fe31544483fcbbae1948fedebd22c311cc781 Mon Sep 17 00:00:00 2001 From: nibon7 Date: Wed, 27 Jul 2022 16:30:03 +0800 Subject: [PATCH] Make path::canonicalize::canonicalize_dot test case more reliable (#6141) Fixes #6139 Signed-off-by: nibon7 --- tests/path/canonicalize.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/path/canonicalize.rs b/tests/path/canonicalize.rs index 937af3f49e..4109c759c7 100644 --- a/tests/path/canonicalize.rs +++ b/tests/path/canonicalize.rs @@ -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); }