Add a test for the env_override
This commit is contained in:
parent
b70d574394
commit
efd19f4a13
2 changed files with 26 additions and 0 deletions
|
|
@ -135,3 +135,10 @@ pub fn features() -> impl Iterator<Item = (&'static str, bool)> {
|
|||
}
|
||||
impl_()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn features_roundtrip() {
|
||||
for (f, _) in features() {
|
||||
let _ = Feature::from_str(f).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -295,6 +295,25 @@ mod tests {
|
|||
println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
|
||||
}
|
||||
|
||||
#[cfg(feature = "std_detect_env_override")]
|
||||
#[test]
|
||||
fn env_override_no_avx() {
|
||||
if let Ok(disable) = crate::env::var("RUST_STD_DETECT_UNSTABLE") {
|
||||
let information = cupid::master().unwrap();
|
||||
for d in disable.split(" ") {
|
||||
match d {
|
||||
"avx" => if information.avx() {
|
||||
assert_ne!(is_x86_feature_detected!("avx"), information.avx())
|
||||
}
|
||||
"avx2" => if information.avx2() {
|
||||
assert_ne!(is_x86_feature_detected!("avx2"), information.avx2())
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compare_with_cupid() {
|
||||
let information = cupid::master().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue