3 ms·
Is putting the unit-tests inline with the code standard best practice in rust? Overall it's an interesting project and seems like a nice showcase of actual rus
by jaytaylor 11y ago
Is putting the unit-tests inline with the code standard best practice in rust?
Overall it's an interesting project and seems like a nice showcase of actual rust src code.
- jdub 11y agoYeah, it's one of the methods supported by Cargo. You can put them in the code or in separate modules. Cargo will also test your documentation examples. :-D
- steveklabnik 11y agoYes, the pattern used here is usual. However, you can also pull any module out to another file, if it gets too big. But the pattern is "Unit tests with the code, integration tests in a separate tests directory".
- jaytaylor 11y agoThanks for explaining. I definitely like the pattern accounting for integration tests! That is really nice.