Improve error display
This commit is contained in:
parent
d4ad3c8ddd
commit
eefb6e5fb6
21
src/error.rs
21
src/error.rs
@ -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\"."
|
||||||
|
Loading…
Reference in New Issue
Block a user