On Sunday, 18 September 2016 at 12:02:47 UTC, Andrei Alexandrescu wrote:
On 9/17/16 5:23 PM, Andrej Mitrovic wrote:
I think at some point someone suggested we could implement explicit
support for such unittests via `static unittest`:

That suggests the unittest shall be evaluated during compilation. -- Andrei

static as in static function. Not much better  imo.

Your solution with static if is fine (ish) , but ugly and a pain for some templates that only accept relatively complicated types. Also requires an external unittest to be kept in sync to ensure that the template is ever instantiated with a those arguments.

What would be really good would be to have a way to make ddoc associate a unittest with a particular symbol, regardless of location.

See e.g. https://github.com/dlang/phobos/pull/4043 where I have to pull all the unittests out of the template in order to get the win 32 tester to pass (fails saying "too many symbols" otherwise), but that ruins the documentation.

Reply via email to