File tree 2 files changed +26
-0
lines changed
crates/std_detect/src/detect
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -135,3 +135,10 @@ pub fn features() -> impl Iterator<Item = (&'static str, bool)> {
135
135
}
136
136
impl_ ( )
137
137
}
138
+
139
+ #[ test]
140
+ fn features_roundtrip ( ) {
141
+ for ( f, _) in features ( ) {
142
+ let _ = Feature :: from_str ( f) . unwrap ( ) ;
143
+ }
144
+ }
Original file line number Diff line number Diff line change @@ -295,6 +295,25 @@ mod tests {
295
295
println ! ( "rtm: {:?}" , is_x86_feature_detected!( "rtm" ) ) ;
296
296
}
297
297
298
+ #[ cfg( feature = "std_detect_env_override" ) ]
299
+ #[ test]
300
+ fn env_override_no_avx ( ) {
301
+ if let Ok ( disable) = crate :: env:: var ( "RUST_STD_DETECT_UNSTABLE" ) {
302
+ let information = cupid:: master ( ) . unwrap ( ) ;
303
+ for d in disable. split ( " " ) {
304
+ match d {
305
+ "avx" => if information. avx ( ) {
306
+ assert_ne ! ( is_x86_feature_detected!( "avx" ) , information. avx( ) )
307
+ }
308
+ "avx2" => if information. avx2 ( ) {
309
+ assert_ne ! ( is_x86_feature_detected!( "avx2" ) , information. avx2( ) )
310
+ }
311
+ _ => { }
312
+ }
313
+ }
314
+ }
315
+ }
316
+
298
317
#[ test]
299
318
fn compare_with_cupid ( ) {
300
319
let information = cupid:: master ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments