phobos unit tests

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 09:59:29 PDT 2016


On Saturday, 3 September 2016 at 15:58:51 UTC, Jonathan M Davis 
wrote:
> On Saturday, September 03, 2016 07:48:14 H. S. Teoh via 
> Digitalmars-d wrote:
>> > In any case, for now, I never put non-generic unit tests in 
>> > templates, and I reject PRs that have them. Sure, having to 
>> > copy-paste your examples sucks, but it doesn't affect the 
>> > code of everyone who uses the template, whereas ddoc-ed unit 
>> > tests do.
>>
>> [...]
>>
>> Actually you don't need to copy-paste your examples, which IMO 
>> is a bad idea to begin with. Just version out the non-generic 
>> unittests when compiling user code, and you can have the best 
>> of both worlds.
>
> And you still have the problem that all of those unit tests 
> will be compiled into every instantiation of the template 
> that's part of your unittest build. So, you end up with longer 
> build times and longer run times for your unit tests. I agree 
> that copy-pasting sucks, but it's what we had to do before with 
> had ddoc-ed unit tests, and I still think that it's better than 
> resulting in all of the additional copies of the tests being 
> compiled in and run - especially if the project isn't small.
>
> - Jonathan M Davis

No need for that - see my other post: 
http://forum.dlang.org/post/psrgjdlvsiukkuhrekoo@forum.dlang.org


More information about the Digitalmars-d mailing list