unittest "name" {}
FeepingCreature
feepingcreature at gmail.com
Sun Feb 19 18:41:47 UTC 2023
On Friday, 10 February 2023 at 21:08:38 UTC, Dennis wrote:
> I was thinking it could be improved by either allowing
> `@"string"` attributes, similar to `@identifier`, or by
> allowing a string literal after the `unittest` keyword:
>
> ```
> unittest "Johny" {
> // Has @("Johny") as first UDA
> }
> ```
>
> This would provide a more ergonomic, standardized way of naming
> tests, and it's a very simple parser change (there's currently
> nothing allowed between `unittest {`).
>
> In many other languages, unittests are regular functions with
> names, but
> [Zig-test](https://ziglang.org/documentation/master/#Zig-Test)
> has this syntax for comparison:
>
> ```Zig
> test "Johny" {
> }
> ```
>
> Question to the community: do you name tests, and do you like
> the idea?
Personal vote: We write unittest names with spaces in, so
`unittest "the test" { }` would be very nice.
The place that the string gets used is when invoking the test
directly: `build/TestRunner 'foo.bar.the test'`.
More information about the Digitalmars-d
mailing list