Skip to content

test: migrate member_errors, multitarget and new to snapbox #14210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/testsuite/member_errors.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Tests for workspace member errors.

#![allow(deprecated)]

use cargo::core::resolver::ResolveError;
use cargo::core::{compiler::CompileMode, Shell, Workspace};
use cargo::ops::{self, CompileOptions};
Expand All @@ -10,6 +8,7 @@ use cargo::util::{context::GlobalContext, errors::ManifestError};
use cargo_test_support::install::cargo_home;
use cargo_test_support::project;
use cargo_test_support::registry;
use cargo_test_support::str;

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

p.cargo("check")
.with_status(101)
.with_stderr(
"\
.with_stderr_data(str![[r#"
[ERROR] invalid string
expected `\"`, `'`
expected `"`, `'`
--> bar/Cargo.toml:8:25
|
8 | foobar == \"0.55\"
8 | foobar == "0.55"
| ^
|
[ERROR] failed to load manifest for dependency `bar`
",
)

"#]])
.run();
}

Expand Down
33 changes: 21 additions & 12 deletions tests/testsuite/multitarget.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Tests for multiple `--target` flags to subcommands

#![allow(deprecated)]

use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host};
use cargo_test_support::prelude::*;
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host, str};

#[cargo_test]
fn simple_build() {
Expand Down Expand Up @@ -71,8 +70,15 @@ fn simple_test() {
.arg(&t1)
.arg("--target")
.arg(&t2)
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t1))
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t2))
.with_stderr_data(
str![[r#"
[RUNNING] unittests src/lib.rs (target/[ALT_TARGET]/debug/deps/foo-[HASH][EXE])
[RUNNING] unittests src/lib.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH][EXE])
...

"#]]
.unordered(),
)
.run();
}

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

p.cargo("run --target a --target b")
.with_stderr("[ERROR] only one `--target` argument is supported")
.with_stderr_data(str![[r#"
[ERROR] only one `--target` argument is supported

"#]])
.with_status(101)
.run();
}
Expand Down Expand Up @@ -130,12 +139,12 @@ fn simple_doc_open() {
.arg(&t1)
.arg("--target")
.arg(&t2)
.with_stderr(
"\
[DOCUMENTING] foo v1.0.0 ([..])
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
[ERROR] only one `--target` argument is supported",
)
.with_stderr_data(str![[r#"
[DOCUMENTING] foo v1.0.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[ERROR] only one `--target` argument is supported

"#]])
.with_status(101)
.run();
}
Expand Down
Loading