[Issue 2630] New: ddoc should be able to document unittests

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 28 09:19:18 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2630

           Summary: ddoc should be able to document unittests
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


I have a hard time coming with examples for phobos' documentation and keeping
them in sync with the library and its unittests. A great way to avoid all that
and also motivate people to write both better documentation and better
unittests would be to enable ddoc's outputting of select unittests. For
example:

/// This is function foo. It does nothing.
void foo() {}

/// The following example calls foo twice.
unittest
{
    foo();
    foo();
}

For the input above, ddoc should generate the regular ddoc fare for foo, and
then print the content of the unittest code nicely formatted and highlighted,
preceded by the header. Now both the unittest and the documentation are in
place and the documentation example always compiles and runs!


-- 



More information about the Digitalmars-d-bugs mailing list