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

Jens Mueller jens.k.mueller at gmx.de
Mon Jan 24 13:32:35 PST 2011


Daniel Gibson wrote:
> Am 24.01.2011 21:39, schrieb Jens Mueller:
> >Andrei Alexandrescu wrote:
> >>On 1/24/11 1:50 PM, Jens Mueller wrote:
> >>>Jonathan M Davis wrote:
> >>>>I think that it's been discussed a time or two, but nothing has been done about
> >>>>it. It wouldn't be entirely straightforward to do. Essentially, either a
> >>>>unittest block would have to be generated from the Examples section in the
> >>>>documentation, or you'd have to have some way to indicate that a particular
> >>>>unittest block got put into the documentation as an Examples section. It's
> >>>>certainly true that it would be ideal to have a way to avoid the duplication,
> >>>>but we don't have one at the moment, and it hasn't yet been a high enough
> >>>>priority to sort out how to do it and implement it.
> >>>
> >>>I see. I understand that it does not have high priority. Just wondered
> >>>whether ...
> >>>
> >>>Jens
> >>
> >>The change is much simpler than what Jonathan suggests. A change can
> >>be made such that any unittest preceded by a documentation comment
> >>is automatically considered an example.
> >>
> >>/**
> >>  Example:
> >>*/
> >>unittest
> >>{
> >>     writeln("This is how it works.");
> >>}
> >
> >That does not work for me.
> >$ dmd -unittest -D -Dftest.html test.d
> >
> >I get an empty example.
> ><dl><dt><big>void<u>__unittest2</u>();
> ></big></dt>
> ><dd><b>Example:</b><br>
> ><br><br>
> >
> ></dd>
> ></dl>
> >
> >Jens
> 
> "A change can be made" - this is a proposal, not an implemented feature.

Stupid me. I was so excited that this may be possible that I didn't read
carefully.

Jens


More information about the Digitalmars-d mailing list