From 56069af42d2b62b594d88668a1ce85a8697b58e6 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Tue, 2 Aug 2022 16:54:26 +0200 Subject: [PATCH] Make `open` test independent of locale (#6211) The test was reading the operating system error message which is dependent on the system locale. Just test for the `(os error 2)` errorcode instead. This should support both unixoid systems and Windows in more locales. --- crates/nu-command/tests/commands/open.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/nu-command/tests/commands/open.rs b/crates/nu-command/tests/commands/open.rs index f2ef3b593e..726adfe316 100644 --- a/crates/nu-command/tests/commands/open.rs +++ b/crates/nu-command/tests/commands/open.rs @@ -214,12 +214,11 @@ fn errors_if_file_not_found() { cwd: "tests/fixtures/formats", "open i_dont_exist.txt" ); - - #[cfg(windows)] - let expected = "The system cannot find the file specified. (os error 2)"; - - #[cfg(not(windows))] - let expected = "No such file or directory (os error 2)"; + // Common error code between unixes and Windows for "No such file or directory" + // + // This seems to be not directly affected by localization compared to the OS + // provided error message + let expected = "(os error 2)"; assert!( actual.err.contains(expected),