Improving unit tests

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri Nov 7 16:33:25 PST 2008


On Fri, Nov 7, 2008 at 6:56 PM, Gide Nwawudu <gide at btinternet.com> wrote:
> Nestable named unittest would be nice. If one group fails, report the
> error and move onto the next.
>
> 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");
>            ...
>        }
> }

_Nice_.



More information about the Digitalmars-d mailing list