mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
test: When a golden test fails, print some extra info
This commit is contained in:
@@ -984,9 +984,15 @@ impl TestContext {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| panic!("Error writing {filename:?}: {e}"));
|
.unwrap_or_else(|e| panic!("Error writing {filename:?}: {e}"));
|
||||||
} else {
|
} else {
|
||||||
|
let green = Color::Green.normal();
|
||||||
|
let red = Color::Red.normal();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
actual, expected,
|
actual,
|
||||||
"To update the expected value, run `UPDATE_GOLDEN_TESTS=1 cargo test`"
|
expected,
|
||||||
|
"{} != {} on {}'s device.\nTo update the expected value, run with `UPDATE_GOLDEN_TESTS=1` environment variable",
|
||||||
|
red.paint("actual chat content (shown in red)"),
|
||||||
|
green.paint("expected chat content (shown in green)"),
|
||||||
|
self.name(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user