Skip to content

Glossary: Software Design Patterns in Rust

#[cfg(test)]

Also written: cfg(test)

An attribute that compiles the code after it only when building tests. It is used on the `mod tests` block so test code never ships in the real program.

Where the book teaches it

Related terms

#[test]