mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 06:47:34 +00:00
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).
This commit is contained in:
parent
4e3901d35f
commit
898fdcc3ed
@ -16,6 +16,9 @@
|
||||
use std::env::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// When HOME is not set, some platforms return `None`, but others return `Some` with a default.
|
||||
/// Just check that it is not "/home/MountainView".
|
||||
|
||||
#[cfg(unix)]
|
||||
fn main() {
|
||||
let oldhome = var("HOME");
|
||||
@ -27,7 +30,7 @@ fn main() {
|
||||
if cfg!(target_os = "android") {
|
||||
assert!(home_dir().is_none());
|
||||
} else {
|
||||
assert!(home_dir().is_some());
|
||||
assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user