1
0

Improve error display

This commit is contained in:
Jeff 2023-10-19 13:52:26 -04:00
parent d4ad3c8ddd
commit eefb6e5fb6

View File

@ -207,10 +207,23 @@ impl fmt::Display for Error {
use Error::*; use Error::*;
match self { match self {
AssertEqualFailed { expected, actual } => write!( AssertEqualFailed { expected, actual } => {
f, write!(f, "Equality assertion failed")?;
"Equality assertion failed. {expected} does not equal {actual}."
), if expected.is_table() {
write!(f, "\n{expected}\n")?;
} else {
write!(f, " {expected} ")?;
}
write!(f, "does not equal")?;
if actual.is_table() {
write!(f, "\n{actual}")
} else {
write!(f, " {actual}.")
}
},
AssertFailed => write!( AssertFailed => write!(
f, f,
"Assertion failed. A false value was passed to \"assert\"." "Assertion failed. A false value was passed to \"assert\"."