Remove Execs::run_expect_error to avoid #14076

This commit is contained in:
Lawrence Chou 2024-06-15 22:55:38 +08:00
parent afe9d17258
commit fde1321381
No known key found for this signature in database
GPG Key ID: 56B65EC9D482438D
3 changed files with 4 additions and 11 deletions

View File

@ -915,15 +915,6 @@ impl Execs {
}
}
#[track_caller]
pub fn run_expect_error(&mut self) {
self.ran = true;
let p = (&self.process_builder).clone().unwrap();
if self.match_process(&p).is_ok() {
panic!("test was expected to fail, but succeeded running {}", p);
}
}
/// Runs the process, checks the expected output, and returns the first
/// JSON object on stdout.
#[track_caller]

View File

@ -632,10 +632,11 @@ fn config_invalid_empty() {
.build();
p.cargo("check")
.with_status(101)
.with_stderr_contains(
"[..]missing field `level`[..] THIS RANDOM SENTENCE SHOULD FAIL THIS TEST BUT DIDN'T",
)
.run_expect_error();
.run();
}
#[cargo_test(>=1.79, reason = "--check-cfg was stabilized in Rust 1.79")]

View File

@ -2933,6 +2933,7 @@ fn use_mtime_cache_in_cargo_home() {
p.change_file("src/lib.rs", "illegal syntax");
p.cargo("check -v")
.env("CARGO_HOME", &cargo_home)
.with_status(101)
.with_stderr(
"\
[DIRTY] foo v0.5.0 ([CWD]): [..]
@ -2942,5 +2943,5 @@ fn use_mtime_cache_in_cargo_home() {
[CHECKING] foo v0.5.0 ([CWD])
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]",
)
.run_expect_error();
.run();
}