unittest "name" {}

WebFreak001 d.forum at webfreak.org
Sat Feb 11 00:03:50 UTC 2023


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.

Maybe it's a good idea to do some critical thinking about this, 
but let's not overdo it, I think this solution is quite 
practical. (though I haven't have critically thought about this 
yet very much)

Q: what does `unittest foo {}` do? try to read variable foo? I 
think if we support that a syntax like `unittest(foo) {}` would 
be more consistent, but maybe we should just make it be 
identifiers that are output as-is into a string. (it would look 
like function definitions and we could add duplication checking 
into the compiler)


More information about the Digitalmars-d mailing list