How to do unittests

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 2 04:56:07 PDT 2015


On Friday, 2 October 2015 at 10:22:40 UTC, Namal wrote:
> On Wednesday, 30 September 2015 at 14:44:20 UTC, qsdf wrote:
>> On Wednesday, 30 September 2015 at 14:20:28 UTC, Namal wrote:
>>> [...]
>>
>> D unit tests are like a stack of free functions. You put them 
>> separatly.
>>
>>
>> when there's a main: dmd -unittest a.d
>> --
>> module a;
>> void main(){}
>>
>> unittest{}
>> --
>>
>>
>> when there is no main: (like std.uri): dmd -main -unittest a.d
>> --
>> module a;
>> unittest{}
>> --
>>
>> the -main switch adds a dummy main function so that the output 
>> can be executed.
>>
>> But most of the time you'll think that nothing happens because 
>> the tests succeed...
>
> So do I understand it right that it stops after the first 
> failed test? Is it possible to continue and get a list of all 
> failed tests?

http://code.dlang.org/packages/unit-threaded
https://github.com/D-Programming-Language/phobos/pull/3207

Atila


More information about the Digitalmars-d-learn mailing list