Back to Browse

Rust Testing Deep Dive: #[test], assert!, PartialEq, and the Rectangle - Rust Book Ch. 11

8 views
May 1, 2026
1:42:37

Writing your first real Rust tests - and discovering why PartialEq and Debug are mandatory. We work through Chapter 11 of the Rust Book (Writing Automated Tests), starting from the bare `#[test]` attribute and `cargo test`, through a hands-on Rectangle `can_hold` example. Along the way we hit assert!, assert_eq!, and the moment Rust won't let you compare custom types without implementing PartialEq and Debug — a common stumbling block that's worth seeing in real time. The rest of the stream is silent coding as the examples get built out. ⏱ Chapters 0:00 Intro music (skip ahead) 3:19 Setup 5:00 Rust Book Ch. 11: the #[test] attribute 7:44 cargo test and library test module structure 8:24 Ignoring tests and doc tests 10:13 Asserting with assert! 12:27 Rectangle struct example 17:14 Writing the can_hold test 20:14 Running the test — it passes 22:58 assert_eq! and assert_ne! 24:43 Argument order (Rust vs JVM frameworks) 26:08 PartialEq and Debug traits for custom types 28:48 Silent coding #Rust #RustLang #RustBook — Watch live: https://twitch.tv/lorduhuru

Download

0 formats

No download links available.

Rust Testing Deep Dive: #[test], assert!, PartialEq, and the Rectangle - Rust Book Ch. 11 | NatokHD