{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreicwez24wv5nqulhs2i5ezaal2745f6roc4r3vomhstts6pj3ao2g4",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mibvrewszam2"
},
"path": "/t/change-error-message-of-a-failing-assert-eq/24118#post_7",
"publishedAt": "2026-03-30T14:38:50.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"googletest - Rust",
"assert_that!",
"matches_pattern!",
"non-fatal assertions"
],
"textContent": "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 use`Result` 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.",
"title": "Change error message of a failing `assert_eq!`"
}