unittesting generic functions

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 03:55:45 PDT 2014


On 14/08/2014 17:14, Nick Treleaven wrote:
> I think it's not possible to have a documented unittest for a method
> that isn't part of the parent template. This is necessary to prevent
> template instantiation recursion sometimes.

Oops, my example wasn't recursive, I meant where the unittest has some 
local aggregate type defined:

struct S(T)
{
     void foo(){}

     ///
     unittest
     {
         class C {}
         S!C s;	// recursive template expansion
         s.foo();
     }
}

unittest
{
     S!int s;
}




More information about the Digitalmars-d mailing list