3 ms·
Note that Rust lets you put tests in tests/ instead of src/. So typically, you put short unit tests in src/ and longer/integration tests in tests/. Oh, and exam
by Yoric 10y ago
Note that Rust lets you put tests in tests/ instead of src/. So typically, you put short unit tests in src/ and longer/integration tests in tests/. Oh, and examples that show up in the documentation are also run alongside tests.
Also, the compiler will tell you if you have code that's not labelled with #[cfg(test)] but is designed to run only in tests.
- tyoverby 10y agoThe big difference with `tests/` is that they have to be integration tests. This means that you can't test private functions from there.
- Manishearth 10y agoNot .. exactly. An integration test usually tests an entire application at once. `tests/` can still test things in the public API (indeed, we do this in Servo a lot) without being an integration test. The point is that some unit tests cannot be written in tests/, whereas all integration tests can be.