Skip to content

Commit

Permalink
Auto merge of #14210 - eth3lbert:snapbox-mmn, r=epage
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Jul 9, 2024
2 parents d1a62df + c888d65 commit 637a2cd
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 167 deletions.
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

0 comments on commit 637a2cd

Please sign in to comment.