5 ms·
> Unfortunately, the author seems to be on the verge of falling into one of the fallacies he rightly points out: assuming that one of the main purposes of unit
by kscaldef 17y ago
> Unfortunately, the author seems to be on the verge of falling into one of the fallacies he rightly points out: assuming that one of the main purposes of unit testing is to act as a surrogate for static analysis. I've seen code written in dynamically-typed languages which tries to do this, and such code pretty much universally falls into the category of "using dynamically-typed languages poorly"
Do you think that tests that check if a return value was null are "using dynamically-typed languages poorly"? Because that's very much an example of using tests to verify something the compiler could have proved for you.
- ubernostrum 17y agoDepends on why you have that test. If you have a function that's supposed to return a null value under certain conditions, then by all means test for it as part of verifying that the code behaves correctly. But if you're obsessively adding "assert the return value is not null" tests for every function, then yeah, you're doin it wrong.