Named unittests

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 14:24:19 PDT 2015


On Tuesday, 31 March 2015 at 20:18:41 UTC, Andrei Alexandrescu 
wrote:
> On 3/31/15 1:04 PM, Jacob Carlborg wrote:
>> On 2015-03-31 16:55, Meta wrote:
>>
>>> Aren't unittest blocks just special functions? If that's the 
>>> case, there
>>> should be no problem being able to give them names. It seems 
>>> to me that
>>> it would entail the lifting of a restriction rather than a 
>>> real language
>>> change.
>>>
>>> Before:
>>> unittest
>>> {
>>>     assert(1 == 1);
>>> }
>>>
>>> After:
>>> unittest checkBasicLaw
>>> {
>>>     assert(1 == 1);
>>> }
>>
>> I prefer a UDA accepting a string, this can contain spaces and 
>> it's not
>> limited to identifier names.
>
> I used to think the same, but then I figured a bit of structure 
> might be preferable. -- Andrei

I see no value in test names limited to valid identifiers. It is 
only tiny bit more informative than `unittestXXX` we have 
already. If we add names, please, let them be proper names that 
are easy to read.


More information about the Digitalmars-d mailing list