DUnit: Advanced unit testing toolkit.

Jacob Carlborg doob at me.com
Wed Sep 25 23:07:49 PDT 2013


On 2013-09-25 21:55, Dicebot wrote:

> UDAs + recent trait to get all unit-tests during compile-time really
> favors instead having lot of small independent annotated unit-test blocks.

If you have more than one test per unit test block you always need to 
run them together, and in the declared order. Example:

unittest
{
     @test("foo")
     {
         assert(1 == 1);
     }

     @test("bar")
     {
         assert(1 == 2);
     }
}

You cannot run "foo" separated from "bar". They all will always run 
together. You also cannot run "bar" before running "foo". Running tests 
like this makes it very easy to introduce order dependencies between the 
tests.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list