I'm able to run unit test for all files in src/ using cargo test --verbose.
All files except main.rs typically look like this and the main.rs file currently looks like:
mod amusement_park;
mod armstrong_number;
mod collatz_conjecture;
mod cone_volume;
...
There are many files in src/ and I have organized them in sub directories like common_concepts, control_flow, etc. But after doing this, I'm not able to run tests.
I tried changing main.rs to:
mod common_concepts::amusement_park;
mod common_concepts::armstrong_number;
mod control_flow:: collatz_conjecture;
mod control_flow:: cone_volume;
but can't get cargo test to work.
How can I run all unit tests in a subdirectory (src/common_concepts or src/control_flow) ?
I'm able to get tests working by changing main.rs to:
mod common_concepts;
mod control_flow;
use common_concepts::amusement_park;
use common_concepts::armstrong_number;
use control_flow::collatz_conjecture;
use control_flow::cone_volume;
and adding mod.rs inside each sub-directory with names of other files. Example src/common_concepts/mod.rs looks like: