@jyn514 not sure if relevant, but quickdoc has had some improvements recently to fix the indentation in the output
I'm getting some unexpected behavior with clojure.test/are. I assumed are cases would evaluate only once, but it seems they evaluate once per use of each param.
Tested and recreated this in a few different dialects: jvm, bb, cljs, cljr, lpy, and phel. So I wonder if this is known/expected behavior.
; fails with different object references
(deftest atoms-are=
(are [x] (= x x)
(atom nil)))
; fails with 3 instead of 1
(deftest increment-atom
(let [counter (atom 0)]
(are [x] (do x x x)
(swap! counter inc))
(is (= 1 @counter))))it's known, idk if it's intended but it's part of the contract now
It is a templating engine and you are templating x in more than once?
To make the above comment a bit more verbose - the docstring of are says:
> Checks multiple assertions with a template expression.
> See clojure.template/do-template for an explanation of templates.
And the docstring of do-template says:
> Repeatedly copies expr (in a do block) for each group of arguments in values.
Note the word "copies".
Interesting, I suppose that makes sense. I guess I expected it to behave similarly to how other args vectors do (like fn or let).
That is always the functor (in the sml sense) question: applicative or generative?