Skip to content

Commit fccc85a

Browse files
authored
Rollup merge of rust-lang#47718 - malbarbo:env-home-dir, r=nikomatsakis
Make run-pass/env-home-dir.rs test more robust Remove the assumption that home_dir always returns Some. This allows the test to be executed with [cross](https://github.com/japaric/cross).
2 parents 3e39180 + adeb0ae commit fccc85a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/run-pass/env-home-dir.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ fn main() {
2727
if cfg!(target_os = "android") {
2828
assert!(home_dir().is_none());
2929
} else {
30-
assert!(home_dir().is_some());
30+
// When HOME is not set, some platforms return `None`,
31+
// but others return `Some` with a default.
32+
// Just check that it is not "/home/MountainView".
33+
assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
3134
}
3235
}
3336

0 commit comments

Comments
 (0)