diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-03-11 13:38:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 13:38:36 +0100 |
| commit | 7189fceab7f4a7d34c103f454ff83d93a58b6407 (patch) | |
| tree | 82070ab43500af0d35aa83fb0c456617d3f8cf09 | |
| parent | f58d51b3c00b1e30acd75aead202eb2248bb33f9 (diff) | |
| parent | b795ae52804e1002e3993551dae69aae745237ce (diff) | |
Rollup merge of #93283 - m1guelperez:master, r=Mark-Simulacrum
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.
| -rw-r--r-- | library/std/src/fs/tests.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 88d87fc532e..6d67c396c62 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -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; @@ -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"); |
