Fix unstable test case: One time my windows report drive letter as lowercase (#14451)

As I'm working on PWD-per-drive feature. Once the plugin test of env
failed. I checked the log, found sometime Windows can give drive letter
as lowercase, so the test case should be rewrite to check first letter
caseinsensitive equal, and following part normal equal.

```
assert_eq! failed at tests/plugins/env.rs:43:5
left: r"e:\Study\Nushell"
right: r"E:\Study\Nushell"
```

---------

Co-authored-by: Zhenping Zhao <pegasus.cadence@gmail.com>
This commit is contained in:
PegasusPlusUS 2024-11-27 04:27:06 -08:00 committed by GitHub
parent 1c18e37a7c
commit bd37473515
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,17 @@ fn get_current_dir() {
"cd tests; example env --cwd"
);
assert!(result.status.success());
#[cfg(not(windows))]
assert_eq!(cwd, result.out);
#[cfg(windows)]
{
// cwd == r"e:\Study\Nushell", while result.out == r"E:\Study\Nushell"
assert_eq!(
cwd.chars().next().unwrap().to_ascii_uppercase(),
result.out.chars().next().unwrap().to_ascii_uppercase()
);
assert_eq!(cwd[1..], result.out[1..]);
}
}
#[test]