Named unittests
David Gileadi via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 31 15:53:41 PDT 2015
On 3/31/15 3:28 PM, Andrei Alexandrescu wrote:
> On 3/31/15 2:50 PM, Martin Nowak wrote:
>> On 03/30/2015 11:52 PM, Andrei Alexandrescu wrote:
>>> I'd like to make a DIP for named unittests. Who can help me with that?
>>
>> Why a DIP, isn't the only question what syntax to use.
>>
>> unittest (myname) vs. unittest ("mynameexpression")
>
> Also unittest myname and unittest "mynameexpression". There will be no
> shortage of folks willing to debate this to smithereens.
One argument for myname (using standard identifier naming rules) is that
it's command-line friendly: it won't require quoting when invoking a
single unit test, and tends toward shorter names. It may also be more
obvious that standard identifier names would use the existing lookup
rules for guaranteeing uniqueness among unittest names.
One argument for "mynameexpression" is that it allows for nice
descriptions (e.g. unittest "count should accept a custom comparator
function").
One compromise might be something like:
@description("count should accept a custom comparator function")
unittest countCustomComparator
Under this example the unittest could be invoked from the command line
by the countCustomComparator name or possibly by the description string
as an alternative.
For the very little it's worth my bikeshed is painted without
parentheses, assuming that's easily implemented.
More information about the Digitalmars-d
mailing list