This commit is contained in:
evan-schott 2023-12-11 12:48:46 -08:00
parent 3ef3cc3f25
commit 1090c3e55e

View File

@ -39,8 +39,7 @@ pub enum TestError {
impl fmt::Display for TestError { impl fmt::Display for TestError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let format_test = let format_test =
|test: &str| -> String { if test.len() > 50 { String::new() } else { format!("\n\n{test}\n\n") } |test: &str| -> String { if test.len() > 50 { String::new() } else { format!("\n\n{test}\n\n") } };
};
match self { match self {
TestError::Panicked { test, index, error } => { TestError::Panicked { test, index, error } => {
write!(f, "test #{}: {}encountered a rust panic:\n{}", index + 1, format_test(test), error) write!(f, "test #{}: {}encountered a rust panic:\n{}", index + 1, format_test(test), error)