Should unittests run as logical part of compilation?
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Sat Jan 25 19:52:24 PST 2014
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.
More information about the Digitalmars-d
mailing list