Static unittests?

Borislav Kosharov boby_dsm at abv.bg
Sun Aug 18 09:15:29 PDT 2013


On Saturday, 17 August 2013 at 17:48:04 UTC, Andrej Mitrovic 
wrote:
> 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
> }

Oh I really haven't tough about that. Maybe, I will try this new 
trait. Or another solution is to add a compiler switch that will 
try to execute all the tests during compilation or something.


More information about the Digitalmars-d mailing list