Skip to content

Commit

Permalink
make assert_stderr_contains print its contents on panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jun 9, 2024
1 parent b6c348f commit aec402b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tools/run-make-support/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ impl CompletedProcess {

#[track_caller]
pub fn assert_stderr_contains<S: AsRef<str>>(self, needle: S) -> Self {
let needle_str = needle.as_ref();
let stderr_str = self.stderr_utf8().as_str();

assert!(
self.stderr_utf8().contains(needle.as_ref()),
format!(
"The stderr {} did not contain the string {}",
self.stderr_utf8().as_str(),
needle.as_ref(),
)
self.stderr_utf8().contains(needle_str),
format!("The stderr \"{}\" did not contain the string \"{}\"", stderr_str, needle_str)
);

self
}

Expand Down

0 comments on commit aec402b

Please sign in to comment.