[phobos] Silent failure of std.container unittests

Adam Ruppe destructionator at gmail.com
Thu Jul 15 15:14:26 PDT 2010


On 7/15/10, Walter Bright <walter at digitalmars.com> wrote:
>> Assertion failure should abort the current unittest block.
>>
>> Do we all agree about the above?
>
> Not me.

That's madness!

unittest {
    auto a = something();
    assert(a !is null);
     a.stuff(); // if a is null, this is meaningless
}

> Everybody's happy except the guys like me who want to run all the unit
> tests in one go.

What you could do is:

unittest { assert(my test); }
unittest { assert(my other test); }
unittest {
  // complex test
}

It is a bit verbose, but you'd get all the results you want without
breaking cases like my first null assert one.


More information about the phobos mailing list