How to do unittests

Namal via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 30 07:20:26 PDT 2015


On Wednesday, 30 September 2015 at 13:03:52 UTC, Rikki Cattermole 
wrote:
> On 01/10/15 1:59 AM, Namal wrote:
>> Hello,
>>
>> can someone give me a complete example please how to do 
>> unittests? I
>> tried this with the example from german wikipedia, but the flag
>> -unittest didn't make any difference.
>
> Example file with loads of unittests: 
> https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/uri.d
>
> If you were to compile it e.g. dmd uri.d it won't be much use 
> (unittest wise). You will need to dmd -unittest uri.d to 
> compile them in. Don't forget to do the same for your main 
> function. When you run the final executable the tests will 
> execute before your main function does.

can't I do unittest in the main?


More information about the Digitalmars-d-learn mailing list