unittest "name" {}
Bogdan
contact at szabobogdan.com
Thu Feb 16 08:29:44 UTC 2023
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 because if you use a
documentation generator, you will have to also add a `///`
comment to have a nice description of the example. 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?
This is what I implemented in `trial`, and it works great.
Currently, the code is parsed using `libdparse`, but I must admit
that it would be great if there would be a trait that gives you
the documentation comment of a symbol. I know there were
discussions about this a few years ago, and it was decided not to
have such a compiler feature.
More information about the Digitalmars-d
mailing list