Pub(test) visibility modifier

Is that strictly true? Can't tests in dependent crates depend on public (exported) symbols in yours defined under cfg(test)?

No, not even your own benchmarks/integration tests will see cfg(test) gated code. It only applies to the binary built for cargo test --lib which runs the unit tests.

1 Like

It would be good to find a solution that works for at least integration tests in the same crate. Is there any way to tell the difference between that and a totally independent crate?

2 Likes