specd - write more expressive unit tests

linkrope linkrope at github.com
Wed Sep 4 04:06:43 PDT 2013


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


More information about the Digitalmars-d-announce mailing list