问题
I am trying to do some test on my no_std
module but I cannot make both integration and unit test working. I think the cargo does not make functions and modules visible to others.
The project is at: https://github.com/ShisoftResearch/Nulloc/tree/e2e15646da79651ddb8c29e0526bad0d60690bec
Run cargo test
, I got:
➜ cargo test
Compiling nulloc v0.1.0 (/Users/shisoft/Dropbox/Code/OSS Projects/Nulloc)
error[E0432]: unresolved import `nulloc::bump_heap`
--> tests/bump_heap.rs:3:14
|
3 | use nulloc::bump_heap::BumpAllocator;
| ^^^^^^^^^ could not find `bump_heap` in `nulloc`
error[E0432]: unresolved import `nulloc::bump_heap`
--> tests/bump_heap.rs:3:14
|
3 | use nulloc::bump_heap::BumpAllocator;
| ^^^^^^^^^ could not find `bump_heap` in `nulloc`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error: could not compile `nulloc`.
warning: build failed, waiting for other jobs to finish...
error: could not compile `nulloc`.
To learn more, run the command again with --verbose.
But I have already extern the crate I am going to test in tests.rs
and bump_heap
have been marked as public in the lib.rs
.
When I try to do run the unit test inside bump_heap.rs
, cargo cannot find the test cases.
I am not sure what's going on here
来源:https://stackoverflow.com/questions/58441073/cargo-test-cannot-reference-anything-public-inside-the-targeting-crate-in-integr