DIP82: static unittest blocks

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 26 22:01:45 PDT 2015


This DIP provides a way to handle unittest blocks inside of 
templates which works with ddoc without compiling the unittest 
blocks into each instantiation.

http://wiki.dlang.org/DIP82


At present, we really can't put unittest blocks - including 
ddoc-ed unittest blocks - inside of templated types, which has 
been a problem for Phobos and came up again just the other day 
when someone was helpful and went and tried to turn the examples 
in std.datetime's *Interval types in ddoc-ed unit tests, but we 
had to reject the changes, because it would have resulted in 
those tests being compiled into every instantiation of those 
templated types, polluting the code of anyone who uses them as 
well as making the Phobos unit tests take longer to run for no 
extra benefit whatsoever.

So, I wrote up this DIP in the hopes of solving the problem in a 
clean and simple manner which fits in well with the existing 
language features.

- Jonathan M Davis


More information about the Digitalmars-d mailing list