phobos unit tests

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 10:16:24 PDT 2016


On Saturday, September 03, 2016 16:56:08 ZombineDev via Digitalmars-d wrote:
> You can just enable the unittests for a single instance that you
> know for sure that it will be used. For example:
> 1)
> https://github.com/dlang/phobos/blob/v2.071.2-b3/std/experimental/ndslice/sl
> ice.d#L808
>
> 2)
> https://github.com/dlang/phobos/blob/v2.071.2-b3/std/experimental/ndslice/sl
> ice.d#L947

So, in order to avoid having the unit tests compiled into the code of anyone
who uses your template, you have to create a special version identifier that
you use with your unit test build and your documentation build, and then you
version the tests within the template with that version. And in order to
avoid having the unit test compiled into every instantiation of that
template during your test, you have to also put it in a static if for a
specific instantiation? Sure, that's feasible, but that's getting _ugly_.

- Jonathan M Davis



More information about the Digitalmars-d mailing list