Skip to content

Commit a97d3f4

Browse files
committed
Make Errored debug rendering readable
1 parent bf517eb commit a97d3f4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test_result.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Various data structures used for carrying information about test success or failure
22
33
use crate::{status_emitter::TestStatus, AbortCheck, Error};
4+
use bstr::ByteSlice;
45
use color_eyre::eyre::Result;
56

67
/// The possible non-failure results a single test can have.
@@ -16,7 +17,6 @@ pub enum TestOk {
1617
pub type TestResult = Result<TestOk, Errored>;
1718

1819
/// Information about a test failure.
19-
#[derive(Debug)]
2020
pub struct Errored {
2121
/// Command that failed
2222
pub(crate) command: String,
@@ -28,6 +28,16 @@ pub struct Errored {
2828
pub(crate) stdout: Vec<u8>,
2929
}
3030

31+
impl std::fmt::Debug for Errored {
32+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33+
writeln!(f, "command: {}", self.command)?;
34+
writeln!(f, "errors: {:#?}", self.errors)?;
35+
writeln!(f, "stderr: {}", self.stderr.to_str_lossy())?;
36+
writeln!(f, "stdout: {}", self.stdout.to_str_lossy())?;
37+
Ok(())
38+
}
39+
}
40+
3141
impl Errored {
3242
/// If no command was executed for this error, use a message instead.
3343
pub fn new(errors: Vec<Error>, message: &str) -> Self {

0 commit comments

Comments
 (0)