Warning
This post was published 65 days ago. The information described in this article may have changed.
If our project is a binary crate that only contains a src/main.rs file and doesnโt have a src/lib.rs file, we canโt create integration tests in the tests directory and bring functions defined in the src/main.rs file into scope with a use statement. Only library crates expose functions that other crates can use; binary crates are meant to be run on their own.
That's fine. But then,
If the important functionality works, the small amount of code in the src/main.rs file will work as well, and that small amount of code doesnโt need to be tested.
I'm unsure why wouldn't one test the complete thing? Just the last line sounds scary, but I'm unsure I understand it. I'd still test some one or two lines left.
3 posts - 3 participants
๐ท๏ธ rust_feed