Showing unittest in documentation (Was Re: std.unittests [updated] for review)

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 24 13:42:03 PST 2011


On Mon, 24 Jan 2011 16:07:38 -0500, Andrej Mitrovic  
<andrej.mitrovich at gmail.com> wrote:

> It's often the case that you want documentation examples to be short,
> but also correct. But you still want to write complex unittests that
> you don't want to put in the documentation. Sounds like a perfect
> candidate for named unittests:
>
> unittest(ddoc)
> {
>    // outputted in documentation
> }
>
> Here "ddoc" would be a predefined identifier, kind of like X86 is for
> version() statements.
>
> unittest // our own complex unittest that we don't want to output in
> the documentation
> {
>     // ...
> }

This would require a language change.

I like the ddoc comment version Andrei posted better.

-Steve


More information about the Digitalmars-d mailing list