Hacker News new | past | comments | ask | show | jobs | submit login

Which one of these bugs would have been prevented by unit tests? Probably none, because you'd have to know about the bug in order to craft a test that exploits it.



Unit tests could prevent reintroducing old bugs.


You have regression tests for those.

http://cvsweb.openbsd.org/src/regress/


This subcategory of unit tests is known as regression tests, and those exist too.


Sometimes that is definitely true.

But very often when you spend time to write unit tests you discover limitations and bugs in your code while you come up with test scenarios.

The only thing that the FTP bug needed was a "test_redirect_responses()" test. The SMTPd bug was all about parsing user input. Ideal candidate for unit testing and probably even some fuzzing.


FTP doesn’t have redirect, so the original code wouldn’t have that test.

The writers who added handling of HTTP would only have added it if they had realized the HTTP library they used could do a redirect. Even if they did, they would have to have thought about redirecting to some specially crafted URL.


Excuses excuses excuses ...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: