automatic code examples in documentation
Tomek Sowiński
just at ask.me
Fri Oct 15 16:49:06 PDT 2010
Andrei Alexandrescu napisał:
>> Let's drill down on this:
>>
>> /// The ultimate foo.
>> void foo();
>>
>> /// The test.
>> unittest { ... }
>>
>> What would be the<dl><dt><dd> outline of the above snippet?
>
> From a ddoc perspective this should be the same as:
>
> /** The ultimate foo.
>
> The test.
> ----
> ...
> ----
> */
> void foo();
I see. That means unittests summarizing the whole of module's goodies would have to be
at the top, but that's passable. Otherwise it's a superb idea.
As I mentioned in bugzilla, it opens the opportunity to kill the unittest naming problem with
the same stone:
void foo();
unittest(owner) {
Log.info("Testing " ~ owner.stringof ~ "...");
scope(exit) Log.info("Testing " ~ owner.stringof ~ " complete");
}
The syntax takes after the out(result) contract. 'owner' is an alias to the preceding symbol.
The overall ROI looks positive, eh?
--
Tomek
More information about the Digitalmars-d
mailing list