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: [email protected]
ReportedBy: [email protected]
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!
--