unittests are really part of the build, not a special run

Kapps via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 2 11:57:18 PDT 2015


On Thursday, 2 April 2015 at 06:33:50 UTC, Jacob Carlborg wrote:
> On 2015-04-01 21:18, Kapps wrote:
>
>> The only issue I have with the way unittests are done right 
>> now, is the
>> incredibly annoying requirement of having a main function and 
>> that main
>> gets called. It makes generic tooling and CI systems much more 
>> annoying,
>> as you have to try and guess whether you need to create a fake 
>> main()
>> (or pass in -main), and worry about if the code is going to 
>> keep running
>> after tests complete.
>
> I just don't compile the module congaing the main function. 
> Although I place the my tests in a completely separate 
> directory.

Which is okay for running your own code, but the problem is it's 
not really a good solution for a CI system. I made a plugin for 
Bamboo to automatically test my dub projects, and essentially 
just rely on the fact that 'dub test' works. Without that, I 
would have no way of knowing whether or not there's a main 
function, whether or not that main function actually does 
something, etc. Being able to prevent main from being required 
and running is, for me, the biggest issue with the current 
unittest system.


More information about the Digitalmars-d mailing list