Peek for panic message in test output

This commit is contained in:
Lukas Wirth 2024-04-19 13:18:30 +02:00
parent 6de838c255
commit 3b9a2af21f
9 changed files with 36 additions and 12 deletions

View file

@ -428,6 +428,17 @@ impl MirEvalError {
}
Ok(())
}
pub fn is_panic(&self) -> Option<&str> {
let mut err = self;
while let MirEvalError::InFunction(e, _) = err {
err = e;
}
match err {
MirEvalError::Panic(msg) => Some(msg),
_ => None,
}
}
}
impl std::fmt::Debug for MirEvalError {