DEV Community

Discussion on: How Simple is too Simple to Test?

Collapse
 
rafalpienkowski profile image
Rafal Pienkowski

Great post and very interesting discussion/code review.

I've seen an even eviler variation of the example you've shown us. Someone has called a validation method and stored its result in a boolean variable. After the iteration result stored in the method, the variable has been returned to a caller. It could end with false positive or false negative result. The result depends only on the last partial validation in the foreach loop, because of the overwriting the method variable in each iteration.

Luckily we've found the issue during code review proces.

Collapse
 
bosepchuk profile image
Blaine Osepchuk

...thereby proving that WTFs/minute is still the only true measure of code quality.

(I've seen something like your example as well.)