Skip to content

Commit 637a2cd

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 d1a62df + c888d65 commit 637a2cd

File tree

3 files changed

+136
-167
lines changed

3 files changed

+136
-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: 21 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,15 @@ 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][EXE])
76+
[RUNNING] unittests src/lib.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH][EXE])
77+
...
78+
79+
"#]]
80+
.unordered(),
81+
)
7682
.run();
7783
}
7884

@@ -84,7 +90,10 @@ fn simple_run() {
8490
.build();
8591

8692
p.cargo("run --target a --target b")
87-
.with_stderr("[ERROR] only one `--target` argument is supported")
93+
.with_stderr_data(str![[r#"
94+
[ERROR] only one `--target` argument is supported
95+
96+
"#]])
8897
.with_status(101)
8998
.run();
9099
}
@@ -130,12 +139,12 @@ fn simple_doc_open() {
130139
.arg(&t1)
131140
.arg("--target")
132141
.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-
)
142+
.with_stderr_data(str![[r#"
143+
[DOCUMENTING] foo v1.0.0 ([ROOT]/foo)
144+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
145+
[ERROR] only one `--target` argument is supported
146+
147+
"#]])
139148
.with_status(101)
140149
.run();
141150
}

0 commit comments

Comments
 (0)