@@ -488,6 +488,7 @@ ftest on
488
488
. run ( ) ;
489
489
}
490
490
491
+ #[ allow( deprecated) ]
491
492
#[ cargo_test]
492
493
fn changing_bin_features_caches_targets ( ) {
493
494
let p = project ( )
@@ -516,86 +517,62 @@ fn changing_bin_features_caches_targets() {
516
517
. build ( ) ;
517
518
518
519
p. cargo ( "build" )
519
- . with_stderr_data ( str![ [ r#"
520
- [COMPILING] foo v0.0.1 ([ROOT]/foo)
521
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
522
-
523
- "# ] ] )
524
- . run ( ) ;
525
- p. rename_run ( "foo" , "off1" )
526
- . with_stdout_data ( str![ [ r#"
527
- feature off
528
-
529
- "# ] ] )
520
+ . with_stderr (
521
+ "\
522
+ [COMPILING] foo v0.0.1 ([..])
523
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
524
+ " ,
525
+ )
530
526
. run ( ) ;
527
+ p. rename_run ( "foo" , "off1" ) . with_stdout ( "feature off" ) . run ( ) ;
531
528
532
529
p. cargo ( "build --features foo" )
533
- . with_stderr_data ( str![ [ r#"
534
- [COMPILING] foo v0.0.1 ([ROOT]/foo)
535
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
536
-
537
- "# ] ] )
538
- . run ( ) ;
539
- p. rename_run ( "foo" , "on1" )
540
- . with_stdout_data ( str![ [ r#"
541
- feature on
542
-
543
- "# ] ] )
530
+ . with_stderr (
531
+ "\
532
+ [COMPILING] foo v0.0.1 ([..])
533
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
534
+ " ,
535
+ )
544
536
. run ( ) ;
537
+ p. rename_run ( "foo" , "on1" ) . with_stdout ( "feature on" ) . run ( ) ;
545
538
546
539
/* Targets should be cached from the first build */
547
540
548
541
let mut e = p. cargo ( "build -v" ) ;
549
542
550
543
// MSVC does not include hash in binary filename, so it gets recompiled.
551
544
if cfg ! ( target_env = "msvc" ) {
552
- e. with_stderr_data ( str![ [ r#"
553
- [DIRTY] foo v0.0.1 ([ROOT]/foo): the list of features changed
554
- [COMPILING] foo v0.0.1 ([ROOT]/foo)
555
- [RUNNING] `rustc --crate-name [..]
556
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
557
-
558
- "# ] ] )
559
- . run ( ) ;
545
+ e. with_stderr (
546
+ "\
547
+ [DIRTY] foo v0.0.1 ([..]): the list of features changed
548
+ [COMPILING] foo[..]
549
+ [RUNNING] `rustc [..]
550
+ [FINISHED] `dev`[..]" ,
551
+ ) ;
560
552
} else {
561
- e. with_stderr_data ( str![ [ r#"
562
- [FRESH] foo v0.0.1 ([ROOT]/foo)
563
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
564
-
565
- "# ] ] ) ;
553
+ e. with_stderr ( "[FRESH] foo v0.0.1 ([..])\n [FINISHED] `dev`[..]" ) ;
566
554
}
567
555
e. run ( ) ;
568
- p. rename_run ( "foo" , "off2" )
569
- . with_stdout_data ( str![ [ r#"
570
- feature off
571
-
572
- "# ] ] )
573
- . run ( ) ;
556
+ p. rename_run ( "foo" , "off2" ) . with_stdout ( "feature off" ) . run ( ) ;
574
557
575
558
let mut e = p. cargo ( "build --features foo -v" ) ;
576
559
if cfg ! ( target_env = "msvc" ) {
577
- e. with_stderr_data ( str![ [ r#"
578
- [DIRTY] foo v0.0.1 ([ROOT]/foo): the list of features changed
579
- [COMPILING] foo v0.0.1 ([ROOT]/foo)
560
+ e. with_stderr (
561
+ "\
562
+ [DIRTY] foo v0.0.1 ([..]): the list of features changed
563
+ [COMPILING] foo[..]
580
564
[RUNNING] `rustc [..]
581
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
582
-
583
- "# ] ] )
584
- . run ( ) ;
565
+ [FINISHED] `dev`[..]" ,
566
+ ) ;
585
567
} else {
586
- e. with_stderr_data ( str! [ [ r#"
587
- [FRESH] foo v0.0.1 ([ROOT]/foo)
588
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
589
-
590
- "# ] ] ) ;
568
+ e. with_stderr (
569
+ " \
570
+ [FRESH] foo v0.0.1 ([..])
571
+ [FINISHED] `dev`[..]" ,
572
+ ) ;
591
573
}
592
574
e. run ( ) ;
593
- p. rename_run ( "foo" , "on2" )
594
- . with_stdout_data ( str![ [ r#"
595
- feature on
596
-
597
- "# ] ] )
598
- . run ( ) ;
575
+ p. rename_run ( "foo" , "on2" ) . with_stdout ( "feature on" ) . run ( ) ;
599
576
}
600
577
601
578
#[ cargo_test]
0 commit comments