Conversation
The convention for clojure.test is `(is (= expected actual))`, which is the reverse of what the template uses in handler_test.clj. This commit switches the arguments to `=` so that failures will be reported correctly.
Could you provide a source for that? |
|
@weavejester sure thing, the clojure.test API reference has a bunch of examples. I also noticed this when I wrote a failing test and saw that "actual" and "expected" were backwards in the output. |
|
I don't see anything in the API reference. The example it gives would work either way around. user> (is (= 5 (+ 2 2)))
FAIL in (:1)
expected: (= 5 (+ 2 2))
actual: (not (= 5 4)) |
|
Yeah, perhaps the docs aren't as explicit on this as I thought. But if you look at examples like this one: They consistently put the expression with the function call second, and the expected return value first. |
|
Sure, but that doesn't mean that the library favours one way over the other, just that the examples just happen to be written like that. |
|
You're right, it turns out that humane-test-output was responsible for making the output look actually wrong when the reverse order is used. With that installed, I get: That won't be an issue for many people, but I do think that following the convention is for the best. If it helps, this is also the way that Clojure's own tests are written (see example). |
The convention for clojure.test is
(is (= expected actual)), which is the reverse of what the template uses in handler_test.clj. This commit switches the arguments to=so that failures will be reported correctly.