<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Testing on rustbites</title><link>https://www.rustbites.com/tags/testing/</link><description>Recent content in Testing on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 30 May 2026 18:44:06 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/testing/index.xml" rel="self" type="application/rss+xml"/><item><title>172. #[track_caller] — Point the Panic at the Caller, Not Your Helper</title><link>https://www.rustbites.com/posts/bite-172/</link><pubDate>Sat, 30 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-172/</guid><description>&lt;p&gt;You wrap an &lt;code&gt;assert&lt;/code&gt; in a helper to clean up your tests. Now every failure points at the helper&amp;rsquo;s source line instead of the test that called it. &lt;code&gt;#[track_caller]&lt;/code&gt; fixes that with a single line of code.&lt;/p&gt;</description></item><item><title>171. assert_matches! — A Test Failure That Actually Tells You What Went Wrong</title><link>https://www.rustbites.com/posts/bite-171/</link><pubDate>Sat, 30 May 2026 09:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-171/</guid><description>&lt;p&gt;&lt;code&gt;assert!(matches!(x, Foo::Bar))&lt;/code&gt; panics with &lt;code&gt;assertion failed: matches!(x, Foo::Bar)&lt;/code&gt; and zero hint about what &lt;code&gt;x&lt;/code&gt; actually was. Rust 1.96 stabilises &lt;code&gt;assert_matches!&lt;/code&gt;, which prints the offending value for you.&lt;/p&gt;</description></item></channel></rss>