unittest ddoc.

Marco Leise Marco.Leise at gmx.de
Mon Jan 30 09:35:31 PST 2012


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 {
		...
	}


More information about the Digitalmars-d mailing list