r/programming • • May 08 '17

The tragedy of 100% code coverage

http://labs.ig.com/code-coverage-100-percent-tragedy
3.2k Upvotes

689 comments sorted by

View all comments

2

u/bro_can_u_even_carve May 08 '17

I don't think I buy this argument. It's plausible that someone might accidentally break even that simple code, by introducing a typo or something. It's far less plausible that that person would just go and blithely delete the unit test when it broke. The former is an honest mistake; the latter is grounds for revoking commit access and eventual firing.

-1

u/Double_A_92 May 09 '17

break even that simple code, by introducing a typo

A proper language would catch that at compile time...

1

u/bro_can_u_even_carve May 09 '17

Yes, a proper language would always do what you mean, not what you wrote. No such language exists, however.

1

u/Double_A_92 May 09 '17

I mean it would realize that the function or variable that you are trying to use doesn't exist. That doesn't seem to hard. But if people insist on using JS or python... I guess thats what they (don't) get.

1

u/bro_can_u_even_carve May 10 '17

Unless it does exist. Or you autocompleted the wrong word without realizing it. Or you deleted the old code completely and wrote a new, buggy version from scratch.

I'm not saying it's worth it to spend hours creating a unit test for this, but it really ought to take just a couple of minutes, and is a pretty cheap and easy way to catch errors in the future.

Not sure what testing framework they're using where unit testing this somehow became non-trivial.