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

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 24 13:45:57 PST 2011


On Mon, 24 Jan 2011 16:36:21 -0500, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Mon, 24 Jan 2011 16:03:24 -0500, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> wrote:

>> Yah, that is an issue. For examples that do non-unittesty stuff (e.g.  
>> writeln, use sockets etc.) we can still use the old-style documentation.
>
> That sounds reasonable, although I still think we need to be able to  
> compile these to prevent doc rot.

Something that might work (should be compiled during ddoc, right?)

/**
Example
*/

unittest
{
   version(DDoc) // should not be outputted to example!
   {
       auto s = new Socket;
       s.connect("192.168.50.5");
       ...
   }
}

-Steve


More information about the Digitalmars-d mailing list