These are the contents of my src/lib.rs
file:
pub fn foo() {}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
foo();
}
}
When I run cargo test
, I get the following error:
error[E0425]: cannot find function `foo` in this scope
--> src/lib.rs:7:9
|
7 | foo();
| ^^^ not found in this scope
How do I call foo
from inside the test
module?