I have a binary Rust project which uses the workspaces to manage sub-crates.
Directory structure
/myapp
Cargo.toml
/src
/tests
test.rs
/crates
/printer
Cargo.toml
/src
myapp/Cargo.toml
[package]
name = "myapp"
[workspace]
members = ["crates/printer"]
Inside of test.rs
I can compile extern crate myapp;
to pull in the parts of the application that are exposed in src/lib.rs
. This works as expected.
However, when attempting to compile extern crate printer;
it errors that it cannot find it. I've confirmed that the printer package is correctly placed in the top-level Cargo.lock
file.
How do I include my sub-crates into the /tests
directory at the top level?