Skip to content

Commit ec77aa9

Browse files
committed
Auto merge of #14143 - heisen-li:dep_dia_dir, r=weihanglo
test: migrate `dep_info/diagnostics/direct_minimal_versions` to snapbox ### What does this PR try to resolve? Complete the migration of the following files: ``` tests/testsuite/dep_info.rs tests/testsuite/diagnostics.rs tests/testsuite/direct_minimal_versions.rs ``` part of #14039
2 parents a879a1c + 113dcf6 commit ec77aa9

File tree

3 files changed

+48
-42
lines changed

3 files changed

+48
-42
lines changed

tests/testsuite/dep_info.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Tests for dep-info files. This includes the dep-info file Cargo creates in
22
//! the output directory, and the ones stored in the fingerprint.
33
4-
#![allow(deprecated)]
5-
64
use cargo_test_support::compare::assert_e2e;
75
use cargo_test_support::paths::{self, CargoPathExt};
86
use cargo_test_support::registry::Package;
@@ -323,7 +321,11 @@ fn relative_depinfo_paths_ws() {
323321
p.cargo("build -Z binary-dep-depinfo --target")
324322
.arg(&host)
325323
.masquerade_as_nightly_cargo(&["binary-dep-depinfo"])
326-
.with_stderr_contains("[COMPILING] foo [..]")
324+
.with_stderr_data(str![[r#"
325+
...
326+
[COMPILING] foo v0.1.0 ([ROOT]/foo/foo)
327+
...
328+
"#]])
327329
.run();
328330

329331
assert_deps_contains(
@@ -360,7 +362,10 @@ fn relative_depinfo_paths_ws() {
360362
p.cargo("build -Z binary-dep-depinfo --target")
361363
.arg(&host)
362364
.masquerade_as_nightly_cargo(&["binary-dep-depinfo"])
363-
.with_stderr("[FINISHED] `dev` profile [..]")
365+
.with_stderr_data(str![[r#"
366+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
367+
368+
"#]])
364369
.run();
365370
}
366371

@@ -446,7 +451,11 @@ fn relative_depinfo_paths_no_ws() {
446451

447452
p.cargo("build -Z binary-dep-depinfo")
448453
.masquerade_as_nightly_cargo(&["binary-dep-depinfo"])
449-
.with_stderr_contains("[COMPILING] foo [..]")
454+
.with_stderr_data(str![[r#"
455+
...
456+
[COMPILING] foo v0.1.0 ([ROOT]/foo)
457+
...
458+
"#]])
450459
.run();
451460

452461
assert_deps_contains(
@@ -482,7 +491,10 @@ fn relative_depinfo_paths_no_ws() {
482491
// Make sure it stays fresh.
483492
p.cargo("build -Z binary-dep-depinfo")
484493
.masquerade_as_nightly_cargo(&["binary-dep-depinfo"])
485-
.with_stderr("[FINISHED] `dev` profile [..]")
494+
.with_stderr_data(str![[r#"
495+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
496+
497+
"#]])
486498
.run();
487499
}
488500

tests/testsuite/diagnostics.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#![allow(deprecated)]
2-
31
use cargo_test_support::project;
2+
use cargo_test_support::str;
43

54
#[cargo_test]
65
fn dont_panic_on_render() {
@@ -20,15 +19,14 @@ edition = "2021"
2019

2120
p.cargo("check")
2221
.with_status(101)
23-
.with_stderr(
24-
"\
25-
error: invalid type: map, expected a sequence
22+
.with_stderr_data(str![[r#"
23+
[ERROR] invalid type: map, expected a sequence
2624
--> Cargo.toml:6:3
2725
|
2826
6 | [[bench.foo]]
2927
| ^^^^^
3028
|
31-
",
32-
)
29+
30+
"#]])
3331
.run();
3432
}

tests/testsuite/direct_minimal_versions.rs

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
//!
33
//! Note: Some tests are located in the resolver-tests package.
44
5-
#![allow(deprecated)]
6-
75
use cargo_test_support::project;
86
use cargo_test_support::registry::Package;
7+
use cargo_test_support::str;
98

109
#[cargo_test]
1110
fn simple() {
@@ -30,13 +29,12 @@ fn simple() {
3029

3130
p.cargo("generate-lockfile -Zdirect-minimal-versions")
3231
.masquerade_as_nightly_cargo(&["direct-minimal-versions"])
33-
.with_stderr(
34-
"\
35-
[UPDATING] [..]
32+
.with_stderr_data(str![[r#"
33+
[UPDATING] `dummy-registry` index
3634
[LOCKING] 2 packages
3735
[ADDING] dep v1.0.0 (latest: v1.1.0)
38-
",
39-
)
36+
37+
"#]])
4038
.run();
4139

4240
let lock = p.read_lockfile();
@@ -79,20 +77,20 @@ fn mixed_dependencies() {
7977
p.cargo("generate-lockfile -Zdirect-minimal-versions")
8078
.masquerade_as_nightly_cargo(&["direct-minimal-versions"])
8179
.with_status(101)
82-
.with_stderr(
83-
r#"[UPDATING] [..]
80+
.with_stderr_data(str![[r#"
81+
[UPDATING] `dummy-registry` index
8482
[ERROR] failed to select a version for `dep`.
85-
... required by package `foo v0.0.1 ([CWD])`
83+
... required by package `foo v0.0.1 ([ROOT]/foo)`
8684
versions that meet the requirements `^1.1` are: 1.1.0
8785
8886
all possible versions conflict with previously selected packages.
8987
9088
previously selected package `dep v1.0.0`
91-
... which satisfies dependency `dep = "^1.0"` of package `foo v0.0.1 ([CWD])`
89+
... which satisfies dependency `dep = "^1.0"` of package `foo v0.0.1 ([ROOT]/foo)`
9290
9391
failed to select a version for `dep` which could resolve this conflict
94-
"#,
95-
)
92+
93+
"#]])
9694
.run();
9795
}
9896

@@ -120,13 +118,12 @@ fn yanked() {
120118

121119
p.cargo("generate-lockfile -Zdirect-minimal-versions")
122120
.masquerade_as_nightly_cargo(&["direct-minimal-versions"])
123-
.with_stderr(
124-
"\
125-
[UPDATING] [..]
121+
.with_stderr_data(str![[r#"
122+
[UPDATING] `dummy-registry` index
126123
[LOCKING] 2 packages
127124
[ADDING] dep v1.1.0 (latest: v1.2.0)
128-
",
129-
)
125+
126+
"#]])
130127
.run();
131128

132129
let lock = p.read_lockfile();
@@ -175,13 +172,12 @@ fn indirect() {
175172

176173
p.cargo("generate-lockfile -Zdirect-minimal-versions")
177174
.masquerade_as_nightly_cargo(&["direct-minimal-versions"])
178-
.with_stderr(
179-
"\
180-
[UPDATING] [..]
175+
.with_stderr_data(str![[r#"
176+
[UPDATING] `dummy-registry` index
181177
[LOCKING] 3 packages
182178
[ADDING] direct v1.0.0 (latest: v1.1.0)
183-
",
184-
)
179+
180+
"#]])
185181
.run();
186182

187183
let lock = p.read_lockfile();
@@ -240,20 +236,20 @@ fn indirect_conflict() {
240236
p.cargo("generate-lockfile -Zdirect-minimal-versions")
241237
.masquerade_as_nightly_cargo(&["direct-minimal-versions"])
242238
.with_status(101)
243-
.with_stderr(
244-
r#"[UPDATING] [..]
239+
.with_stderr_data(str![[r#"
240+
[UPDATING] `dummy-registry` index
245241
[ERROR] failed to select a version for `indirect`.
246242
... required by package `direct v1.0.0`
247-
... which satisfies dependency `direct = "^1.0"` of package `foo v0.0.1 ([CWD])`
243+
... which satisfies dependency `direct = "^1.0"` of package `foo v0.0.1 ([ROOT]/foo)`
248244
versions that meet the requirements `^2.1` are: 2.2.0, 2.1.0
249245
250246
all possible versions conflict with previously selected packages.
251247
252248
previously selected package `indirect v2.0.0`
253-
... which satisfies dependency `indirect = "^2.0"` of package `foo v0.0.1 ([CWD])`
249+
... which satisfies dependency `indirect = "^2.0"` of package `foo v0.0.1 ([ROOT]/foo)`
254250
255251
failed to select a version for `indirect` which could resolve this conflict
256-
"#,
257-
)
252+
253+
"#]])
258254
.run();
259255
}

0 commit comments

Comments
 (0)