Unit Tests
Test Functions
Controlling How Tests Are Run
Test Organization
Unit Tests:
- Inside the same module as the tested code
- annotated with
#[cfg(test)] - can test private code by default
- import tested code with
super::* - compiled only with
cargo test
Integration tests:
- inside top level
testsfolder - need to import tested code by crate name
- place util functions in a
mod.rsto avoid testing them, e.g:tests/common/mod.rs - compiled only with
cargo test