Enabling Only Top-Level Unittests

Anonymouse via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 21 05:35:42 PDT 2016


On Monday, 21 March 2016 at 10:29:36 UTC, Nordlöw wrote:
> I want to enable unittests only at the top-level of a module 
> compilation.
>
> If I have a module
>
>     top.d
>
> that imports
>
>     dep1.d
>     dep2.d
>     ...
>
> which all contain unittests, how do I compile top.d with only 
> the unittests for top.d enabled?

Version the unittests, perhaps.

module depN;

version (TestDeps)
unittest {
     // ...
}

Then dmd -unittest -version=TestDeps if you want them run.


More information about the Digitalmars-d-learn mailing list