mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 01:43:47 +01:00
Make path::canonicalize::canonicalize_dot test case more reliable (#6141)
Fixes #6139 Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
parent
c8adb06ca7
commit
b67fe31544
@ -96,22 +96,20 @@ fn canonicalize_absolute_path_relative_to() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn canonicalize_dot() {
|
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 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);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn canonicalize_many_dots() {
|
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 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);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user