Why think unit tests should be in their own source code hierarchy instead of side-by-side

Atila Neves atila.neves at gmail.com
Thu Mar 22 17:24:27 UTC 2018


On Thursday, 22 March 2018 at 16:54:18 UTC, Anton Fediushin wrote:
> On Thursday, 22 March 2018 at 16:30:37 UTC, H. S. Teoh wrote:
>> As for the dub-specific problems introduced by 
>> version(unittest): IMO that's a flaw in dub.  I should not 
>> need to contort my code just to accomodate some flaw in dub.  
>> Having said that, though, I do agree that version(unittest) 
>> itself is a bad idea, so code written the way I recommend 
>> would not have this problem even given dub's flaws.
>
> There's no "dub-specific problems". Article is wrong about 
> that: when you run `dub test` only package you are working with 
> is compiled with '-unittest' option. This way it is 
> _impossible_ to have any kind of problems with 
> `version(unittest)` if you are writing libraries

IMHO dub does it exactly right - I most definitely do _not_ want 
to build my dependencies's unittests, nor do I want to run them.

Imagine if I had to parse and run the tests from libclang or Qt 
(worse: both!) every time I wrote a C++ program...

Atila


More information about the Digitalmars-d-announce mailing list