Should unittests run as logical part of compilation?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jan 26 19:45:04 PST 2014


On 1/25/14 7:52 PM, Jesse Phillips wrote:
> 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.

That's great but I wasn't thinking of CTFEing unittests as much as just 
running them right after building.

Andrei


More information about the Digitalmars-d mailing list