dunit r247

Daniel Keep daniel.keep.lists at gmail.com
Thu Mar 19 17:31:23 PDT 2009



Christopher Wright wrote:
> bearophile wrote:
>> What's the advantage of:
>> expect(foo(5), equals(3) | greaterThan(5));
>> Compared to:
>> expect(foo(5) == 3 | foo(5) > 5);
> 
> What error message should that give?
> 
> The former gives:
> Expected: equal to 3 or greater than 5
> But was: <whatever value foo(5) returned>
> 
> The latter gives:
> Assertion error

What about this syntax?

check!("% == 3 || % == 5")(foo(5));

This could display:

Expected: (% == 3 || % == 5) for <value of foo(5)>.

Then you don't have to dick about writing classes when you want to test
something.  Rule one of a good API: get out of my way. :D

  -- Daniel


More information about the Digitalmars-d-announce mailing list