3 ms·
I agree that you don't generally /need/ to test preconditions of internal code (although you should document them). However, if you're writing a library with a
by kybernetikos 7y ago
I agree that you don't generally /need/ to test preconditions of internal code (although you should document them). However, if you're writing a library with an API that will be called by others, you should make sure your code fails fast, and you should assert that behavior in your tests.
Adding extra code to ensure you fail fast is often well worth it in future debugging time, even for internal code.