2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
//@ ignore-wasm32-bare no env vars
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-01-27 12:20:58 -08:00
|
|
|
use std::env::*;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2015-02-11 11:47:53 -08:00
|
|
|
for (k, v) in vars_os() {
|
2020-12-03 18:07:29 -08:00
|
|
|
// On Windows, the environment variable NUMBER_OF_PROCESSORS has special meaning.
|
|
|
|
|
// Unfortunately, you can get different answers, depending on whether you are
|
|
|
|
|
// enumerating all environment variables or querying a specific variable.
|
|
|
|
|
// This was causing this test to fail on machines with more than 64 processors.
|
|
|
|
|
if cfg!(target_os = "windows") && k == "NUMBER_OF_PROCESSORS" {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 11:47:53 -08:00
|
|
|
let v2 = var_os(&k);
|
2015-11-19 19:07:27 +00:00
|
|
|
assert!(v2.as_ref().map(|s| &**s) == Some(&*v),
|
2015-01-27 12:20:58 -08:00
|
|
|
"bad vars->var transition: {:?} {:?} {:?}", k, v, v2);
|
|
|
|
|
}
|
|
|
|
|
}
|