I'm doing (is (= expected-long-string (generate-long-string)))
in a clojure.test
test.
The string contains many lines separated by newlines.
If the test fails, clojure.test displays them as a single long line comparison failed in the report, the newlines are shown as \n
.
Is there a function that will show me some kind of diff of the two strings?
It would be much more easy to spot the difference in the actual result compared to the generated string that way.
@vinai there's something called "humane test output" or such
might help
Thanks @fossifoo, googling
Loads without error but doesn't work with cider version > 0.10. I'm using 0.14.
Oh noes, seems like it won't be fixed soon. The issue has been open for a almost exactly a year now (https://github.com/clojure-emacs/cider-nrepl/issues/336).
yeah, i never used that from the repl, sorry
no worries, thanks for your help! I would be surprised if there is no workaround somehow.
well i guess you could just rewrite your test to check that the diff between the strings is nil
but i guess most diff functions (including data/diff) dont work so well on character based changes
so if you are checking EDN or JSON or such, i would maybe not serialise it or deserialize prior to chekcing
This is going to be a scaffold test based on stdout output of a legacy application, so I'm pretty much stuck with string comparison. However... if I split that by lines into a vector, maybe then the output is nicer.
No luck
i'm trying to get spec.test/check to work, but it only produces ()
when i add (stest/check ['sut/make-log])
to my test ns
summarize-results says {:total 0} 😞
hmmm. i think i'll try to get a simpler example to run
yay. it "works". now i get "clojure.spec/failure :no-gen"
ah, i messed up the args spec. this still feels very much like a "no training weels" experience
are there any tools around to handle midje & clojure.test & spec.check?
it seems to me that test.check is very "bare bones"