4 ms·
Referential integrity in code-under-test is convenient for unit testing, so unit tests encourage (re)discovery of functional style by programmers who are workin
by arebop 18y ago
Referential integrity in code-under-test is convenient for unit testing, so unit tests encourage (re)discovery of functional style by programmers who are working in non-functional languages.
But unit tests also have value in programs that are written in functional languages and in a functional style. Unit tests reinforce essential properties of the program and thereby formalize the accidental/essential boundary. They can provide guidance about how API elements are intended to be used together. They can present elements and properties of a program in an order that is best for explanation (they can be a crude form of literate programming). So, it's wrong to reduce unit testing to functional programming.