-
Notifications
You must be signed in to change notification settings - Fork 0
Rust Testing
Guilherme Kunigami edited this page Mar 14, 2019
·
4 revisions
Basic file hierarchy under src:
|-- tests
| |-- my_test.rs
| |-- mod.rs
`-- lib.rs
NOTE: nothing goes on main.rs
-
src/lib.rs:mod tests;
-
src/tests/mod.rs:mod my_test;
-
src/tests/my_test.rs:
.
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
Simplest:
cargo test --lib
Print output to stdout
cargo test --lib -- --nocapture