Skip to content

Glossary: Rust Beyond the Basics

assert!, assert_eq!, assert_ne!

Also written: assert, assert_eq!, assert_ne!, assert macros

Macros that check a result in a test and panic if the check fails, which makes the test fail. `assert_eq!` checks two values are equal, `assert_ne!` that they differ, and `assert!` that a condition is true.

Where the book teaches it

Related terms

#[test]unit test