On Thursday, 26 September 2013 at 06:07:50 UTC, Jacob Carlborg wrote:
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.

I was saying that if you want to have some tests independent, it makes much more sense to do it this way:

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

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

..and let tests within one block terminate on first failure. That should integrate better with existing tooling when no external testing library/framework is connected.

Reply via email to