Question for all the @rustlang hackers out there -- Do you prefer #[cfg(test)] stuff in your crate, or code in the tests/*.rs files for testing the majority of your code when your library is almost entirely public API?
13
2
1
14
Both The cfg for unit tests and in the /tests for integration tests
1
4
When it's a library crate, what counts as integration tests?

Jan 20, 2020 Β· 10:28 PM UTC

2
I count as integration what is public and how it interacts with clients. I avoid things like mocking for example in integration tests whereas in unit tests they’re almost always used.
1
It depends on the create. It could be the interaction between different functions of the create, or with external resources (db, files, network,...)
1