Static unittests?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Aug 17 10:47:53 PDT 2013


On 8/17/13, Borislav Kosharov <boby_dsm at abv.bg> wrote:
> I really think that this should be added to the language, because
> it doesn't break stuff and it is useful. And the 'static' keyword
> is already used in many places like module imports and ifs.

Have you tried using the new getUnitTests trait in the git-head
version? If not it will be in the 2.064 release.

Btw such a 'static unittest' feature is certainly going to break code
because static can be applied as a label, for example:

class C
{
static:
    void foo() { }

    unittest { /* Test the foo method. */ }   // suddenly evaluated at
compile-time
}


More information about the Digitalmars-d mailing list