Error while using use for my own library in integration tests

Viewed 36

I'm writting a library in Rust for a project and I wanted to add integration tests following the Rust Book. So I added a tests folder (following the Rust Book : https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html) next to the src folder. But I cannot use my lib's functions in the tests/test.rs file I created. I tried use crate_name, etc but I always got errors like:

error[E0432]: unresolved import `maths`
 --> tests/lib.rs:1:5
  |
1 | use maths;
  |     ^^^^^ no external crate `maths`

or

error[E0433]: failed to resolve: use of undeclared crate or module `maths`
 --> tests/lib.rs:3:5
  |
3 |     maths::fight::resolve_fight(regiment_1, regiment_2);
  |     ^^^^^ use of undeclared crate or module `maths`

I'm just trying to do integration tests on my crate to ensure everything is working as it should.

0 Answers
Related