-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a test fails, there is a set of parens around the actual result #735
Comments
Rings a bell, we tried to improve this area recently (which probably didn't worsen anything, but might not have fixed all cases). We'll take a look! |
I've found the cause of the issue –
If you macroexpand This results in this behaviour:
|
Thanks for that! That might be only half of the story though. Note that that ns hasn't changed over 2 years. What has changed recently is the way of printing test results. Will take a look at both areas 👀 |
(For clarity, I'm talking about #713) |
Ok, so
which means this bug has existed as-is for a couple years at least. (I verified so just now by reviewing https://github.com/clojure-emacs/cider-nrepl/commits/master/src/cider/nrepl/middleware/test/extensions.clj) Probably it has been unnoticed because a cider-nrepl based connection willl typically run tests through cider, rather than by hitting clojure.test directly? Anyway this is an unfortunate situation, mutating clojure.test globally seems pretty far from ideal. Maybe we can refactor things to not touch clojure.test multimethods while preserving the desired behavior? For example here we define our own multimethod: cider-nrepl/src/cider/nrepl/middleware/test.clj Lines 142 to 149 in 338023f
That model seems cleaner. |
Maybe instead of making the extension not-global, we could just fix it to handle Hopefully getting its intended diffing behavior reasonably right won't be too much of a hassle. |
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` ariry 3+ Fixes #735
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` ariry 3+ Fixes #735
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` ariry 3+ Fixes #735
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` arity 3+ Fixes #735
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` arity 3+ Fixes #735
* Unwrap lists for :actual for `=` arity 2 * Use traditional clojure.test notation for `=` arity 3+ Fixes #735
Released in CIDER 1.2 / cider-nrepl 0.27.4. |
Moved from nrepl/nrepl#260
Expected behaviour
When a test fails in directly in Clojure, I get the following output:
Actual behavior
When I run the same test through a Cider nREPL, I get the following output, (this is taken from a Calva REPL):
The key difference here is that Clojure shows that the expected result was
\a
, but nREPL says the actual result was(\a)
.This is confusing. It makes it difficult to debug why a test has failed, because it appears like the actual result is a list of
\a
, (i.e.'(\a)
), rather that\a
. This also makes it very difficult to copy+paste results into tests expectations.Steps to reproduce the problem
Evaluate the following two forms in a nREPL:
I see the following in the Calva nREPL log:
Which shows that the string is being produced server-side, and is not being altered by Calva.
Environment & Version information
cider-nrepl version
cider-nrepl 0.27.3
nrepl 0.8.3
Java version
Operating system
macOS 12.0.1 (21A559)
The text was updated successfully, but these errors were encountered: