cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Expected and actual values are swapped compared to typical Clojure test runners in test diffs

Open cap10morgan opened this issue 2 years ago • 3 comments

Typically in Clojure tests the expected value comes first and the actual value second.

For example:

(is (= expected actual))

Other test runners then report the expected vs. actual values correctly when the args to = are in that order.

But in Cursive when you view a failed test diff, it puts the first arg in the Actual column and the second arg in the Expected column.

It would be nice if this matched the typical convention of expected first, actual second.

cap10morgan avatar Feb 21 '23 21:02 cap10morgan

+1, I have this same issue.

For reference, clojure.test never explicitly says you should put expected before actual, but every single example in the docs is written in the form (is (= expected actual)): https://clojure.github.io/clojure/clojure.test-api.html

miridius avatar Mar 15 '23 11:03 miridius

I just tried to reproduce this, and I couldn't. Cursive doesn't actually say "expected" or "actual" in its diff, it just says "left" and "right". Those values seem to be correctly populated in the diff, i.e. the left hand value appears in the left of the diff, and vice versa. I also can't see that any relevant code has changed since this issue was filed, am I missing something?

cursive-ghost avatar Jun 12 '24 23:06 cursive-ghost

It's been long enough I'll have to re-investigate this. But I will do that soon. Thanks!

cap10morgan avatar Jun 13 '24 02:06 cap10morgan

OK, yeah, it's still happening:

Here's an example is form with the expected value first and the actual value second. This is a de facto standard that most (all?) other test runners rely on:

Screenshot 2024-07-15 at 2 53 44 PM

And here is what Cursive shows when that test fails and you click on <Click to see difference>:

Screenshot 2024-07-15 at 2 53 00 PM

As you can see the expected value is in the "Actual" pane and the actual value is in the "Expected" pane.

cap10morgan avatar Jul 15 '24 20:07 cap10morgan

Oh, I see - you're talking about the test runner, not the interactive testing in the REPL i.e. this rather than this. Yes, I can see that, I'll fix that.

cursive-ghost avatar Jul 17 '24 19:07 cursive-ghost

Fix released in 1.13.4-eap8 on 2024-07-23.

cursive-ghost avatar Jul 23 '24 01:07 cursive-ghost

Fix released in 1.13.4-eap8 on 2024-07-23.

Thanks! This is a great improvement! :)

devurandom avatar Jul 23 '24 12:07 devurandom

Fix released in 1.13.4 on 2024-08-06.

cursive-ghost avatar Aug 06 '24 01:08 cursive-ghost