about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-30 17:10:51 +0800
committerGitHub <noreply@github.com>2018-01-30 17:10:51 +0800
commitfccc85a0ad151533c422b7071d8a2e954ec605e2 (patch)
tree4a27a75a349e0b17555a9897cb880ee22249a96f
parent3e3918070639d74d5469a6d2fa7cc5ac21bdad89 (diff)
parentadeb0aeb4a21fe3a944285ad72dab01c10765398 (diff)
downloadrust-fccc85a0ad151533c422b7071d8a2e954ec605e2.tar.gz
rust-fccc85a0ad151533c422b7071d8a2e954ec605e2.zip
Rollup merge of #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).
-rw-r--r--src/test/run-pass/env-home-dir.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/run-pass/env-home-dir.rs b/src/test/run-pass/env-home-dir.rs
index 22e440c6ffa..9bbff1eeb81 100644
--- a/src/test/run-pass/env-home-dir.rs
+++ b/src/test/run-pass/env-home-dir.rs
@@ -27,7 +27,10 @@ fn main() {
     if cfg!(target_os = "android") {
         assert!(home_dir().is_none());
     } else {
-        assert!(home_dir().is_some());
+        // When HOME is not set, some platforms return `None`,
+        // but others return `Some` with a default.
+        // Just check that it is not "/home/MountainView".
+        assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
     }
 }