Skip to content
Guilherme Kunigami edited this page Mar 13, 2019 · 4 revisions

Basic file hierarchy under src:

|-- tests
|   |-- my_test.rs
|   |-- mod.rs
`-- lib.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);
}

Running the tests:

cargo test --lib

Clone this wiki locally