Skip to content

Commit 262f2dd

Browse files
committed
Auto merge of #14210 - eth3lbert:snapbox-mmn, r=epage
test: migrate member_errors, multitarget and new to snapbox ### What does this PR try to resolve? Part of #14039. Migrate following to snapbox: - `tests/testsuite/member_errors.rs` - `tests/testsuite/multitarget.rs` - `tests/testsuite/new.rs`
2 parents e98f702 + 4076a08 commit 262f2dd

File tree

3 files changed

+135
-167
lines changed

3 files changed

+135
-167
lines changed

tests/testsuite/member_errors.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Tests for workspace member errors.
22
3-
#![allow(deprecated)]
4-
53
use cargo::core::resolver::ResolveError;
64
use cargo::core::{compiler::CompileMode, Shell, Workspace};
75
use cargo::ops::{self, CompileOptions};
@@ -10,6 +8,7 @@ use cargo::util::{context::GlobalContext, errors::ManifestError};
108
use cargo_test_support::install::cargo_home;
119
use cargo_test_support::project;
1210
use cargo_test_support::registry;
11+
use cargo_test_support::str;
1312

1413
/// Tests inclusion of a `ManifestError` pointing to a member manifest
1514
/// when that manifest fails to deserialize.
@@ -48,18 +47,17 @@ fn toml_deserialize_manifest_error() {
4847

4948
p.cargo("check")
5049
.with_status(101)
51-
.with_stderr(
52-
"\
50+
.with_stderr_data(str![[r#"
5351
[ERROR] invalid string
54-
expected `\"`, `'`
52+
expected `"`, `'`
5553
--> bar/Cargo.toml:8:25
5654
|
57-
8 | foobar == \"0.55\"
55+
8 | foobar == "0.55"
5856
| ^
5957
|
6058
[ERROR] failed to load manifest for dependency `bar`
61-
",
62-
)
59+
60+
"#]])
6361
.run();
6462
}
6563

tests/testsuite/multitarget.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//! Tests for multiple `--target` flags to subcommands
22
3-
#![allow(deprecated)]
4-
5-
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host};
3+
use cargo_test_support::prelude::*;
4+
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host, str};
65

76
#[cargo_test]
87
fn simple_build() {
@@ -71,8 +70,14 @@ fn simple_test() {
7170
.arg(&t1)
7271
.arg("--target")
7372
.arg(&t2)
74-
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t1))
75-
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t2))
73+
.with_stderr_data(
74+
str![[r#"
75+
[RUNNING] unittests src/lib.rs (target/[ALT_TARGET]/debug/deps/foo-[HASH])
76+
[RUNNING] unittests src/lib.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH])
77+
...
78+
"#]]
79+
.unordered(),
80+
)
7681
.run();
7782
}
7883

@@ -84,7 +89,10 @@ fn simple_run() {
8489
.build();
8590

8691
p.cargo("run --target a --target b")
87-
.with_stderr("[ERROR] only one `--target` argument is supported")
92+
.with_stderr_data(str![[r#"
93+
[ERROR] only one `--target` argument is supported
94+
95+
"#]])
8896
.with_status(101)
8997
.run();
9098
}
@@ -130,12 +138,12 @@ fn simple_doc_open() {
130138
.arg(&t1)
131139
.arg("--target")
132140
.arg(&t2)
133-
.with_stderr(
134-
"\
135-
[DOCUMENTING] foo v1.0.0 ([..])
136-
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
137-
[ERROR] only one `--target` argument is supported",
138-
)
141+
.with_stderr_data(str![[r#"
142+
[DOCUMENTING] foo v1.0.0 ([ROOT]/foo)
143+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
144+
[ERROR] only one `--target` argument is supported
145+
146+
"#]])
139147
.with_status(101)
140148
.run();
141149
}

0 commit comments

Comments
 (0)