On Saturday, 25 January 2014 at 22:55:33 UTC, Andrei Alexandrescu
wrote:
There's this simple realization that unittests could (should?)
be considered an intrinsic part of the build process. In order
for an executable to be worth running, it should pass the
regular semantic checks and also the unittests, which in a
sense are extended semantic checks that fall outside the
traditional charter of the compiler.
In that view, asserts inside unittests should fail with the
same message format as regular compilation errors, i.e.
./modulename.d(103): Unittest failed: user-defined message
I already attempt to get unittests to fail at compile time by
using static assert. I think running it during compilation would
be a great change. Though cross compiling is a valid concern and
should be addressed.
Many are use to the notion that unittest are separate from
compilation, I think this is only due to familiarity. Other than
the cross-compile issue, I believe moving it closer to the time
of compilation is the correct direction, but it will get distaste
from those familiar with JUnit/NUnit and other unittesting
frameworks just as it currently does.