unittest ddoc.

Don Clugston dac at nospam.com
Mon Jan 30 09:55:06 PST 2012


On 30/01/12 18:35, Marco Leise wrote:
> Am 30.01.2012, 17:45 Uhr, schrieb David Nadlinger <see at klickverbot.at>:
>
>> On 1/30/12 5:39 PM, Gor Gyolchanyan wrote:
>>> Wouldn't it be great if the compiler inserted the body of the unittest
>>> ino the ddoc as an example?
>
> Yeah the idea is reaching far back.
>
>> At least for me, unit tests tend to be more complex/convoluted than
>> example code, because they cover different edge cases, etc., so I'd
>> rather go the opposite direction: allow automatic extraction of
>> »Example:« blocks as unit tests (this has also been proposed for
>> Phobos before).
>>
>> David
>
> This obfuscates the language too much. A comment shouldn't be executed,
> come on :p
> What about:
>
> unittest(ddoc) {
> ... Readable use case example goes here ...
> }
>
> - or -
>
> example {
> ...
> }

OR:
/** optionally explain what this test is doing */
unittest {.... }



More information about the Digitalmars-d mailing list