2 ms·
> Functions can end in a where: clause that holds unit tests for the function. These assertions are checked dynamically. Wouldn't it be even better to check th
by vog 10y ago
> Functions can end in a where: clause that holds unit tests for the function. These assertions are checked dynamically.
Wouldn't it be even better to check these statically, such that a program with failing unit tests doesn't even compile?
There may be tests that can't be checked statically, but I think these wouldn't quality as unit tests anyway. (These would be more at the level of integration tests.)
- skrishnamurthi 10y agoTests are, by definition, checked dynamically. And setting aside terminology, there's a small issue called the Halting Problem that makes most tests unable to be checked statically.