unittest "name" {}

Atila Neves atila.neves at gmail.com
Thu Feb 16 12:27:26 UTC 2023


On Thursday, 16 February 2023 at 08:29:44 UTC, Bogdan wrote:
> On Monday, 13 February 2023 at 12:05:05 UTC, Atila Neves wrote:
>> On Saturday, 11 February 2023 at 00:03:50 UTC, WebFreak001 
>> wrote:
>>> On Friday, 10 February 2023 at 22:24:54 UTC, Dennis wrote:
>>>> On Friday, 10 February 2023 at 21:48:00 UTC, Steven 
>>>> Schveighoffer wrote:
>>>>> I personally am fine with the requirements to use a UDA.
>>>>>
>>>>> And I also prefer the simple "first string" method,
>>>>
>>>> My proposal is purely syntactic sugar, it's exactly the same 
>>>> as adding a first string UDA.
>>>
>>> I like this idea, and I think as @("") has already become the 
>>> de-facto standard across testing frameworks on DUB we can 
>>> just make it behave like that and everyone will be happy 
>>> without breaking changes + it's all quite an easy change for 
>>> everyone.
>>
>> The reason I used a string UDA initially (and, probably why 
>> silly does the same thing) is to avoid having to import a 
>> symbol to use it there. It's the simplest thing that will work 
>> and not "corrupt" production code.
>>
>> Don't get me started on version(unittest).
>
>
> I think using @("") is some kind of a hack

People didn't generally attach string UDAs to tests before, so it 
doesn't intrude and "just works".

> because if you use a documentation generator, you will have to 
> also add a `///` comment to have a nice description of the 
> example.

IMHO that should go on the function, not the test.

> But since there is already a way to explain what a unit test is 
> doing, and I am referring to the `///` comment, why don't you 
> just use that comment?

For me at least, because it'd be incredibly annoying to select 
that test to run in the command line. I think that if you need a 
comment to explain what the test is doing, then you should 
rewrite the test.




More information about the Digitalmars-d mailing list