@@ -290,5 +290,26 @@ mod test {
290
290
let ( default, others) = metadata. targets ( ) ;
291
291
assert_eq ! ( default , "i686-pc-windows-msvc" ) ;
292
292
assert ! ( others. is_empty( ) ) ;
293
+
294
+ // make sure that `default_target` always takes priority over `targets`
295
+ metadata. default_target = Some ( "i686-apple-darwin" . into ( ) ) ;
296
+ let ( default, others) = metadata. targets ( ) ;
297
+ assert_eq ! ( default , "i686-apple-darwin" ) ;
298
+ assert_eq ! ( others. len( ) , 1 ) ;
299
+ assert ! ( others. contains( & "i686-pc-windows-msvc" ) ) ;
300
+
301
+ // make sure that `default_target` takes priority over `HOST_TARGET`
302
+ metadata. extra_targets = Some ( vec ! [ ] ) ;
303
+ let ( default, others) = metadata. targets ( ) ;
304
+ assert_eq ! ( default , "i686-apple-darwin" ) ;
305
+ assert ! ( others. is_empty( ) ) ;
306
+
307
+ // and if `extra_targets` is unset, it should still be set to `TARGETS`
308
+ metadata. extra_targets = None ;
309
+ let ( default, others) = metadata. targets ( ) ;
310
+ assert_eq ! ( default , "i686-apple-darwin" ) ;
311
+ let tier_one_targets_no_default: Vec < _ > = TARGETS . iter ( ) . filter ( |& & t| t != "i686-apple-darwin" ) . copied ( ) . collect ( ) ;
312
+ assert_eq ! ( others, tier_one_targets_no_default) ;
313
+
293
314
}
294
315
}
0 commit comments