Skip to content

Glossary: Coding Interviews in Rust

#[test]

Also written: test function, test_

An attribute marking a Rust function as a test that `cargo test` runs and reports. Before that, a hand-made function named `test_…` that calls `assert_eq!` does the same job.

Where the book teaches it

Related terms

assert_eq!#[cfg(test)]Cargo