Example unittests?
Adam D Ruppe
destructionator at gmail.com
Mon Oct 17 12:55:02 UTC 2022
On Monday, 17 October 2022 at 05:23:19 UTC, Andrej Mitrovic wrote:
> It's funny you should mention this. I just had the thought
> yesterday that we don't really need the `///` documented
> unittest feature anymore (except for backwards compatibility).
>
> Nowadays we could instead define some UDAs in Druntime that the
> compiler could pick up.
The doc comment gives you a place to write an explanation too...
even if you had a @ddoc uda you'd probably still want the ///
explanation text. So the uda doesn't gain much.
(though i kinda do wish we had some standard udas anyway, a few
doc things come to mind from time to time)
> - `@ddoc!symbol`, allowing users to put the documented unittest
> anywhere in the code, rather than being forced to make it the
> very first unittest following a symbol name.
With adrdox you can reorder tests but they still must be attached
right after the decl:
http://dpldocs.info/experimental-docs/adrdox.syntax.html#documented-unittests
but that's a decent idea to allow it to search the whole module.
More information about the Digitalmars-d
mailing list