Skip to content

Commit c826531

Browse files
committed
test(freshness::changing_bin_features_caches_targets): Revert snapbox to isolate https://github.com/rust-lang/cargo/pull/14161/files#r1660080269
1 parent 14cbe9e commit c826531

File tree

1 file changed

+36
-59
lines changed

1 file changed

+36
-59
lines changed

tests/testsuite/freshness.rs

Lines changed: 36 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ ftest on
488488
.run();
489489
}
490490

491+
#[allow(deprecated)]
491492
#[cargo_test]
492493
fn changing_bin_features_caches_targets() {
493494
let p = project()
@@ -516,86 +517,62 @@ fn changing_bin_features_caches_targets() {
516517
.build();
517518

518519
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+
)
530526
.run();
527+
p.rename_run("foo", "off1").with_stdout("feature off").run();
531528

532529
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+
)
544536
.run();
537+
p.rename_run("foo", "on1").with_stdout("feature on").run();
545538

546539
/* Targets should be cached from the first build */
547540

548541
let mut e = p.cargo("build -v");
549542

550543
// MSVC does not include hash in binary filename, so it gets recompiled.
551544
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+
);
560552
} 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`[..]");
566554
}
567555
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();
574557

575558
let mut e = p.cargo("build --features foo -v");
576559
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[..]
580564
[RUNNING] `rustc [..]
581-
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
582-
583-
"#]])
584-
.run();
565+
[FINISHED] `dev`[..]",
566+
);
585567
} 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+
);
591573
}
592574
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();
599576
}
600577

601578
#[cargo_test]

0 commit comments

Comments
 (0)