3 ms·
There are limits to unit tests. For example, suppose I have a function I need to be pure (i.e. it does not modify any global state). No amount of unit testing w
by WalterBright 17y ago
There are limits to unit tests. For example, suppose I have a function I need to be pure (i.e. it does not modify any global state). No amount of unit testing will prove that it is pure. But a static type system check by the compiler can prove it is pure.
Unit testing and static type checking have some overlap, but it is not complete overlap. Both are desirable.
- gnosis 17y agoYep. There's nothing that prevents unit tests from being used in a program written in a statically typed language. The difference is that in a program written in statically typed language you'd have to write fewer unit tests than you would were you to use a dynamically typed language, as in the former much of that testing is going to be automatically done for you by the compiler.