On 30/01/12 18:35, Marco Leise wrote:
Am 30.01.2012, 17:45 Uhr, schrieb David Nadlinger <s...@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 {.... }

Reply via email to