3 ms·
> Also, .unwrap() is fine for unit test mocking you need in real world code. People keep saying this but it is sometimes incredibly frustrating how little peop
by stormbrew 4y ago
> Also, .unwrap() is fine for unit test mocking you need in real world code.
People keep saying this but it is sometimes incredibly frustrating how little people annotate their test failure points in rust unit tests. I would really like to see more people get a little verbose in their tests and use the third arg of the assert macros and .expect with explanations of what the line is trying to prove.
- topspin 4y agoWhat I have in mind is when your unit test scaffold must populate some collection or whatnot from a file that's part of the code base, or similar legwork. The read might fail somehow but if it does you have bigger problems, so .unwrap() is fine.