Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for localized windows editions in testcase fn read_link() Issue#93211 #93283

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::io::prelude::*;

use crate::env;
use crate::fs::{self, File, OpenOptions};
use crate::io::{ErrorKind, SeekFrom};
use crate::path::Path;
Expand Down Expand Up @@ -906,7 +907,14 @@ fn read_link() {
// junction
assert_eq!(check!(fs::read_link(r"C:\Users\Default User")), Path::new(r"C:\Users\Default"));
// junction with special permissions
assert_eq!(check!(fs::read_link(r"C:\Documents and Settings\")), Path::new(r"C:\Users"));
// Since not all localized windows versions contain the folder "Documents and Settings" in english,
// we will briefly check, if it exists and otherwise skip the test. Except during CI we will always execute the test.
if Path::new(r"C:\Documents and Settings\").exists() || env::var_os("CI").is_some() {
assert_eq!(
check!(fs::read_link(r"C:\Documents and Settings\")),
Path::new(r"C:\Users")
);
}
}
let tmpdir = tmpdir();
let link = tmpdir.join("link");
Expand Down