Skip to content

Commit

Permalink
Rollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Fix for localized windows editions in testcase fn read_link() Issue#93211

This PR aims to fix the issue with localized windows versions that do not necessarily have the folder "Documents and settings" in English.

The idea was provided by `@the8472.` We check if the "CI" environment variable is set, then we always check for the "Documents and Settings"-folder, otherwise we check if the folder exists on the local machine, and if not we skip this assert.

Resoles #93211.
  • Loading branch information
Dylan-DPC authored Mar 11, 2022
2 parents f58d51b + b795ae5 commit 7189fce
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit 7189fce

Please sign in to comment.