Named unittests

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 07:45:49 PDT 2015


On Tuesday, 31 March 2015 at 13:34:24 UTC, Dicebot wrote:
> On Tuesday, 31 March 2015 at 10:25:57 UTC, Idan Arye wrote:
>> I understand the preference to librarize as much as possible, 
>> but I don't think the desire to sacrifice every possible bit 
>> of convenience to avoid the tiniest changes to the language is 
>> always beneficial. I don't say that implementing everything 
>> inside the compiler is good either though, but in many cases 
>> some slight changes to the language can make the library 
>> solution so much more simple and elegant.
>>
>> In this case, allowing to name a unittest should be a very 
>> simple language change that'll make any library implementation 
>> of the rest of the feature more elegant to use, simpler to 
>> implement, and more consistent with alternative library 
>> implementations.
>
> It isn't simple at all. Name is just one of many meta-values 
> you commonly want to attach to unittest block. Some others: 
> description, dependency, parallelization, benchmark tag, I/O 
> indicator. It is simply impossible to foresee it all in a 
> language feature - but it is exactly kind of data UDA are 
> designed for. All we need is to enhance/fix the language to 
> actually make using of that information convenient.

But unittests already have 
names(http://dpaste.dzfl.pl/b15e94000f15), so the only required 
change is to allow the user to specify that name. This should be 
much simpler than adding entirely new fields.


More information about the Digitalmars-d mailing list