Skip to content

Commit 898fdcc

Browse files
committed
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).
1 parent 4e3901d commit 898fdcc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use std::env::*;
1717
use std::path::PathBuf;
1818

19+
/// When HOME is not set, some platforms return `None`, but others return `Some` with a default.
20+
/// Just check that it is not "/home/MountainView".
21+
1922
#[cfg(unix)]
2023
fn main() {
2124
let oldhome = var("HOME");
@@ -27,7 +30,7 @@ fn main() {
2730
if cfg!(target_os = "android") {
2831
assert!(home_dir().is_none());
2932
} else {
30-
assert!(home_dir().is_some());
33+
assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
3134
}
3235
}
3336

0 commit comments

Comments
 (0)