Fork me on GitHub

After quite bit of experimentation, I refactored my specs, code and tests for a bank account and learnt a bit about qualified keys and auto-resolve macro. I have specs that I can use with my clojure.test unit tests I updated the journal to show how I would create the specs, unit tests and code now And the specs are in their own namespace, using a Clojure Common extension, .cljc (I believe all the specs are host neutral)


s/or requires labels for the alternatives: (s/or :qualified (s/keys :req [...]) :unqualified (s/keys :req-un [...]))


Oh yes, labels. At 2.30am I tend to forget things :white_frowning_face: I find fdef a bit opaque, some more reading and experimenting to do. Thanks for spotting the bug in last-name, not intentional. Thanks for the review


I got the spec/or expression to wrap the :req and :req-un versions working. I have my fdef :args validating after instrumenting. Still working on testing the :ret in the fdef...


Right, :args is for instrument -- checking that your code is calling the function correctly -- and :ret/`:fn` are for generative testing, to make sure your function behaves correctly.


With instrument, :ret and :fn are ignored. With check, :args is used to generate conforming arguments and then the function is called and the :ret and :fn specs are checked against the return value and against the arguments/return value respectively.


A lot of people don't feel the docs are clear enough about :args/`instrument` and :ret/`:fn`/`check`


I’m comfortable with instrument for now. I don’t seem to have something right with check yet, but will look again tomorrow. Thanks.