unittests and templates

Steven Schveighoffer schveiguy at yahoo.com
Tue May 11 13:14:30 PDT 2010


On Tue, 11 May 2010 16:06:31 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:


> The ugly solution is to use static if like so:
>
> static if(isIntegral!V)
> {
>     unittest
>     {
>     }
> }
>
> But that is, well, ugly.

I found a less ugly solution -- remove the braces:

static if(isIntegral!V) unittest
{
    ...
}

This is probably fine for most purposes.

I'd still like the non-generic unit test near the function declaration.

-Steve


More information about the Digitalmars-d-learn mailing list