External Publication
Visit Post

Change error message of a failing `assert_eq!`

Rust Internals [Unofficial] March 30, 2026
Source

It's worth checking out the design of googletest - Rust which uses matcher expressions to make it more obvious that the right side is the expected value (e.g. assert_that! documentation) and also it has advanced matchers that provide more detailed error messages, printing subexpressions wherever Debug is implemented (matches_pattern!). It also adds its own test runner that you may optionally use to support tests that useResult for failures instead of panic-based assertions or support non-fatal assertions to be able to see multiple failures instead of stopping at the first.

Discussion in the ATmosphere

Loading comments...