Specifying which Phobos modules to unittest

Christian Köstlin christian.koestlin at gmail.com
Thu May 10 10:05:27 PDT 2012


On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote:
> Hello all,
>
> Is there any way to specify individual Phobos modules to unittest when
> building, instead of having to do the whole lot?
>
> When working on 1 single module, it'd be nice to be able to unittest
> that one alone and not have to worry about doing the complete set of
> tests until ready to push back to GitHub.
>
> Can anyone advise?
>
> Thanks & best wishes,
>
> -- Joe
the tests are not executed at compile time but instead at runtime before 
main(). so you have to compile the modules seperately, and only the 
modules you want to test with the unittest flag.
that means:
dmd -c module1.d module2.d module3.d
dmd -c -unittest module_with_tests.d
dmd module1.o module2.d module3.o module_with_tests.o

when you run your linked program your should only get the unittests from 
moduel_with_tests.

regards

christian



More information about the Digitalmars-d-learn mailing list