From bd374735153d189ff24ee8003af4f8272c7c646c Mon Sep 17 00:00:00 2001 From: PegasusPlusUS <95586924+PegasusPlusUS@users.noreply.github.com> Date: Wed, 27 Nov 2024 04:27:06 -0800 Subject: [PATCH] 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 --- tests/plugins/env.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/plugins/env.rs b/tests/plugins/env.rs index 8b307999b3..d7d1555f02 100644 --- a/tests/plugins/env.rs +++ b/tests/plugins/env.rs @@ -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]