specd - write more expressive unit tests

jostly johan.f.ostling at gmail.com
Wed Sep 4 10:39:32 PDT 2013


On Wednesday, 4 September 2013 at 11:06:45 UTC, linkrope wrote:
> It would be nice to have something like
>
>     result.must.not.be!">"(42);
>
> So, have a look at 'assertOp':
> http://d.puremagic.com/issues/show_bug.cgi?id=4653
>
> How can a user of your code add matchers, for example, to check 
> for elements or attributes in XML? (Without having to change 
> your code.) The hidden 'MatchStatement' makes the code easy to 
> use but seems to make it hard to extend. You could add a second 
> ('matcher') parameter to 'must', but then you have to switch 
> from '.' to '('...')':
>
>     result.must(haveTag("root"));
>
> By the way: Does the color output work on Windows?
> Here is what I do to color the unit-test results:
> https://github.com/linkrope/dunit/blob/master/dunit/color.d

Thanks for the feedback and the pointers - I think they're all 
good ideas. I'll look into making the necessary adjustments.


More information about the Digitalmars-d-announce mailing list