Skip to content

Commit beab81a

Browse files
committed
Auto merge of #14410 - epage:tests, r=weihanglo
test: Migrate old_cargos to snapbox This is part of #14039
2 parents cc74523 + 7977e04 commit beab81a

File tree

1 file changed

+36
-41
lines changed

1 file changed

+36
-41
lines changed

tests/testsuite/old_cargos.rs

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
//! cargo test --test testsuite -- old_cargos --nocapture --ignored
1111
//! ```
1212
13-
#![allow(deprecated)]
14-
1513
use std::fs;
1614

1715
use cargo::CargoResult;
1816
use cargo_test_support::prelude::*;
1917
use cargo_test_support::registry::{self, Dependency, Package};
20-
use cargo_test_support::{cargo_exe, execs, paths, process, project, rustc_host};
18+
use cargo_test_support::{cargo_exe, execs, paths, process, project, rustc_host, str};
2119
use cargo_util::{ProcessBuilder, ProcessError};
2220
use semver::Version;
2321

@@ -640,32 +638,32 @@ fn index_cache_rebuild() {
640638
.with_process_builder(tc_process("cargo", "1.48.0"))
641639
.arg("check")
642640
.cwd(p.root())
643-
.with_stderr(
644-
"\
645-
[UPDATING] [..]
641+
.with_stderr_data(str![[r#"
642+
[UPDATING] `[ROOT]/registry` index
646643
[DOWNLOADING] crates ...
647-
[DOWNLOADED] bar v1.0.0 [..]
644+
[DOWNLOADED] bar v1.0.0 (registry `[ROOT]/registry`)
648645
[CHECKING] bar v1.0.0
649-
[CHECKING] foo v0.1.0 [..]
650-
[FINISHED] [..]
651-
",
652-
)
646+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
647+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [ELAPSED]s
648+
649+
"#]])
653650
.run();
654651

655652
fs::remove_file(p.root().join("Cargo.lock")).unwrap();
656653

657654
// This should rebuild the cache and use 1.0.1.
658655
p.cargo("check")
659-
.with_stderr(
660-
"\
661-
[UPDATING] [..]
656+
.with_stderr_data(str![[r#"
657+
[WARNING] no edition set: defaulting to the 2015 edition while the latest is [..]
658+
[UPDATING] `dummy-registry` index
659+
[LOCKING] 2 packages to latest compatible versions
662660
[DOWNLOADING] crates ...
663-
[DOWNLOADED] bar v1.0.1 [..]
661+
[DOWNLOADED] bar v1.0.1 (registry `dummy-registry`)
664662
[CHECKING] bar v1.0.1
665-
[CHECKING] foo v0.1.0 [..]
666-
[FINISHED] [..]
667-
",
668-
)
663+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
664+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
665+
666+
"#]])
669667
.run();
670668

671669
fs::remove_file(p.root().join("Cargo.lock")).unwrap();
@@ -675,12 +673,11 @@ fn index_cache_rebuild() {
675673
.with_process_builder(tc_process("cargo", "1.48.0"))
676674
.arg("tree")
677675
.cwd(p.root())
678-
.with_stdout(
679-
"\
680-
foo v0.1.0 [..]
676+
.with_stdout_data(str![[r#"
677+
foo v0.1.0 ([ROOT]/foo)
681678
└── bar v1.0.0
682-
",
683-
)
679+
680+
"#]])
684681
.run();
685682
}
686683

@@ -714,33 +711,31 @@ fn avoids_split_debuginfo_collision() {
714711
.arg("build")
715712
.env("CARGO_INCREMENTAL", "1")
716713
.cwd(p.root())
717-
.with_stderr(
718-
"\
719-
[COMPILING] foo v0.1.0 [..]
720-
[FINISHED] [..]
721-
",
722-
)
714+
.with_stderr_data(str![[r#"
715+
[COMPILING] foo v0.1.0 ([ROOT]/foo)
716+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
717+
718+
"#]])
723719
.run();
724720

725721
p.cargo("build")
726722
.env("CARGO_INCREMENTAL", "1")
727-
.with_stderr(
728-
"\
729-
[COMPILING] foo v0.1.0 [..]
730-
[FINISHED] [..]
731-
",
732-
)
723+
.with_stderr_data(str![[r#"
724+
[WARNING] no edition set: defaulting to the 2015 edition while the latest is [..]
725+
[COMPILING] foo v0.1.0 ([ROOT]/foo)
726+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
727+
728+
"#]])
733729
.run();
734730

735731
execs()
736732
.with_process_builder(tc_process("cargo", "stable"))
737733
.arg("build")
738734
.env("CARGO_INCREMENTAL", "1")
739735
.cwd(p.root())
740-
.with_stderr(
741-
"\
742-
[FINISHED] [..]
743-
",
744-
)
736+
.with_stderr_data(str![[r#"
737+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
738+
739+
"#]])
745740
.run();
746741
}

0 commit comments

Comments
 (0)