Showing unittest in documentation (Was Re: std.unittests [updated] for review)
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jan 25 04:59:43 PST 2011
On Mon, 24 Jan 2011 17:32:12 -0500, Andrew Wiley <debio264 at gmail.com>
wrote:
>
> Here's another approach:
> When you think about it, what we're after is tagging unit tests as code
> examples, so why not do exactly that with annotations?
>
> @example(Foo.bar)
> unittest {
> //...
> }
>
> It means there are no new keywords to worry about, and this feels more
> like
> a job for metadata than a language feature to me. We'd probably have to
> formalize adding parameters to annotations, but that's pretty much
> inevitable if they're ever going to reach a useful state.
This changes the compiled language. A comment is safe to ignore, so it's
not part of the compiled language, similar to how ddoc comments are not
part of the compiled code. It fits perfectly with a ddoc comment.
Using a ddoc comment to trigger an example in ddoc feels perfectly
correct. What I'd like to do is make it less repetitive.
-Steve
More information about the Digitalmars-d
mailing list