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.
This commit is contained in:
Stefan Holderbach 2022-08-02 16:54:26 +02:00 committed by GitHub
parent 376d22e331
commit 56069af42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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),