Unit tests in D

Adam D. Ruppe destructionator at gmail.com
Wed May 5 11:15:10 PDT 2010


On Wed, May 05, 2010 at 11:04:13AM -0700, Walter Bright wrote:
> But why? Just use:
> 
>    foo(10);

I used the static assert not compiles thing for the octal template -

unittest{
	static assert(!__traits(compiles, octal!"not a number"));

	// and checking that it doesn't convert implicitly
	long a;
	static assert(!__traits(compiles, a = octal!"7777777777777");
}

That kind of thing - makes sure it gave the right types for the right
input.


So I see the use, but I don't think any special syntax is required. This
works well enough.

-- 
Adam D. Ruppe
http://arsdnet.net


More information about the Digitalmars-d mailing list