@betterC, @TestBetterC , @betterCTest or @("betterC") to annotate Phobos's unittests?

Jacob Carlborg doob at me.com
Tue Jul 31 10:09:08 UTC 2018


On 2018-07-29 16:21, Seb wrote:
> Phobos has recently gotten a primitive way to run betterC tests
> (https://github.com/dlang/phobos/pull/6640).
>
> Now, it would be really cool if we can annotate existing tests with e.g.
> `@betterCTest` and thus ensure that those tests work with -betterC (i.e.
> extract them and run them with a minimal test runner.
>
> a) @betterC
>
> Probably too popular and would lead to too many conflicts.

Shouldn't be any conflict because the "betterC" symbol would be in a 
different module.

> b) @TestBetterC
> c) @betterCTest || @bettercTest
>
> Would probably be defined a enum somewhere in `std.internal`
>
> d) @("betterC")
>
> A bit ugly and harder to work with. If we ever want to name the
> unittests in Phobos, this will make it harder.

I really hate that this is possible to do with UDAs. We should avoid 
this as much as possible.

> At some point we might also want to test whether something runs even
> without any runtime (https://github.com/dlang/phobos/pull/6641), so e.g.
> `@baremetalTest` might be defined too.
>
> My favorite is (c) - any objections?
>
> See also: https://github.com/dlang/tools/pull/357 (implementation of the
> test extraction filter for UDAs)

I would say, if it's only for internal use then it can be placed in 
`std.internal` with the `package` protection. If you want this to be 
used outside of Phobos then I recommend putting it in `core.attribute` 
in druntime, since that already exists.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list