On 8/5/13, Bosak <bo...@gmail.com> wrote: > Are compile-time unittests possible in D? Maybe something like: > > static unittest { > assert(2 == 1 + 1); > }
Nope. Interestingly, in git-head we now have the getUnitTests trait, however this won't allow us to call the tests at compile time, I get back: Error: __unittestL5_1 cannot be interpreted at compile time, because it has no available source code This trait is fairly new, so maybe we could expand on this to allow invoking the tests at compile time. Note of course that fundamentally not all tests can be executed at compile-time (e.g. any kind of use of files makes them non-CTFE-able)