unittest blocks not being run inside of class and struct templates

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 25 08:03:24 PDT 2017


On Tuesday, 25 July 2017 at 02:48:57 UTC, NoBigDeal256 wrote:
> What is the standard way of testing class templates in the 
> context of a library where some of the classes may never 
> actually be used by the library itself?

Write a test and instantiate whatever templates you want to test.

class Test(T) {
}

unittest {
     auto t=new Test!int;
     assert(t.method1()==1);
}


More information about the Digitalmars-d-learn mailing list