Static unittests?

Bosak bosak at gmail.com
Mon Aug 5 05:25:34 PDT 2013


Are compile-time unittests possible in D? Maybe something like:

static unittest {
     assert(2 == 1 + 1);
}

So that every assert in the unittest is translated to static 
assert. And no normal asserts to be allowed in static unittest?
So the above code would be executed at compile time and 
translated to:

unittest {
     static assert(2 == 1 + 1);
}


More information about the Digitalmars-d mailing list