dunit r247

Gide Nwawudu gide at btinternet.com
Thu Mar 19 11:26:32 PDT 2009


On Thu, 19 Mar 2009 11:34:52 -0400, bearophile
<bearophileHUGS at lycos.com> wrote:

>Christopher Wright:
>
>Having other testing frameworks/tools for D is good. There are many kinds of testing, and the built-in one isn't supposed to implement them all.
>
>Regarding the issues of unit testing with unittest{}, I think the built-in unittesting has to be improved, to removed some of such issues. I am not looking for an universal and perfect built-in unittesting, and I think the built-in unittesting has to be kept simple, but the following things have to be fixed, maybe Walter will eventually understand why they are important:
>- Unittests are not labeled.
>- There is no output that specifically indicates that the tests were run.
>- A failing test will prevent any other tests from running. 
>- There is no indication of which test failed, if any.
>Such things are bare-bone functionality for any unit testing system.
>And I'd like to add a way to unittest at compile time too, to test types, templates, etc. (Until few weeks ago I didn't know any way at all to do this, then someone has given me a hint).
>
I think that nestable named unittest would be nice. I'll raise it as
an enhancement request.

unittest ("XML") {
	unittest("elements") {
	    assert(isValidXml("<aaa />"));
	    assert(isValidXml("<aaa/>"));
	    assert(isValidXml("<aaa></aaa>"));
            ...
	}
	unittest("attributes") {
	    assert(isValidXml("<aaa abc="\x\"/>"));
	    assert(isValidXml("<aaa abc=\"x\" def=\"y\"/>"));
            ...
	}
	unittest("encoding") {
	    assert(encode("hello") is "hello");
	    assert(encode("a > b") == "a &gt; b");
	    ...
	}		
}

Gide


More information about the Digitalmars-d-announce mailing list