What's the use case for a library integ test as opposed to a unit test?

⚓ rust    📅 2025-06-11    👤 surdeus    👁️ 2      

surdeus

I don't understand the point of integ tests for a lib. Whatever you can do in a library you can also do as a unit test, but unit tests can also test private functions. What's the benefit here?

The only thing I can think of is that restriction is a feature, as in it ensures that your public API has everything needed to function properly (i.e. things that need to be pub are pub).

I also am curious why cargo test doesn't seem to differentiate between unit or integ tests. I'd think that a lot of binary integration tests wouldn't want to automatically be run locally, while unit tests should be fine.

1 post - 1 participant

Read full topic

🏷️ rust_feed