Hacker News new | ask | show | jobs
by gaius 6027 days ago
f you have 100% code coverage you don't necessarily have 100% path coverage

That is an absolutely crucial point in languages where side-effects are not controlled.

1 comments

And also for languages where side-effects are controlled.
But it is easier when you're dealing with a "pure" function. In something like Haskell, a function that doesn't touch any of the stateful sequencing monads is guaranteed to neither alter nor depend on any sort of global state.

In my experience, the times that lack of path coverage gets you into the most trouble is when one large-ish function depends in subtle ways on global state, and inevitably there are bugs involving one or two global states that you don't catch in testing, and then you get errors out in production and have to figure out what on earth is causing it. Not fun.