@@ -437,6 +437,55 @@ fn build_only_bar_dependency() {
437
437
) ;
438
438
}
439
439
440
+ #[ test]
441
+ fn all_targets_with_and_without ( ) {
442
+ let p = project ( "foo" )
443
+ . file (
444
+ "Cargo.toml" ,
445
+ r#"
446
+ [package]
447
+ name = "foo"
448
+ version = "0.1.0"
449
+ authors = []
450
+ "# ,
451
+ )
452
+ . file ( "src/main.rs" , "fn main() {}" )
453
+ . build ( ) ;
454
+ assert_that (
455
+ p. cargo ( "rustc" ) . arg ( "-v" ) . arg ( "--all-targets" ) ,
456
+ execs ( ) . with_status ( 0 )
457
+ // bin
458
+ . with_stderr_contains ( "\
459
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
460
+ --emit=dep-info,link[..]")
461
+ // bench
462
+ . with_stderr_contains ( "\
463
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
464
+ -C opt-level=3 --test [..]")
465
+ // unit test
466
+ . with_stderr_contains ( "\
467
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
468
+ -C debuginfo=2 --test [..]") ,
469
+ ) ;
470
+ assert_that ( p. cargo ( "clean" ) , execs ( ) . with_status ( 0 ) ) ;
471
+ assert_that (
472
+ p. cargo ( "rustc" ) . arg ( "-v" ) ,
473
+ execs ( ) . with_status ( 0 )
474
+ // bin
475
+ . with_stderr_contains ( "\
476
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
477
+ --emit=dep-info,link[..]")
478
+ // bench
479
+ . with_stderr_does_not_contain ( "\
480
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
481
+ -C opt-level=3 --test [..]")
482
+ // unit test
483
+ . with_stderr_does_not_contain ( "\
484
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
485
+ -C debuginfo=2 --test [..]") ,
486
+ ) ;
487
+ }
488
+
440
489
#[ test]
441
490
fn fail_with_multiple_packages ( ) {
442
491
let foo = project ( "foo" )
0 commit comments