This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-07
Channels
- # beginners (41)
- # boot (38)
- # cider (17)
- # cljs-dev (52)
- # cljsjs (3)
- # clojure (200)
- # clojure-italy (8)
- # clojure-russia (50)
- # clojure-spec (28)
- # clojure-uk (45)
- # clojurescript (28)
- # core-async (9)
- # core-matrix (2)
- # cursive (16)
- # datascript (15)
- # datomic (50)
- # dirac (5)
- # emacs (20)
- # figwheel (8)
- # flambo (2)
- # hoplon (10)
- # incanter (1)
- # jobs (1)
- # leiningen (2)
- # lumo (26)
- # mount (171)
- # off-topic (22)
- # om (54)
- # onyx (2)
- # pedestal (27)
- # re-frame (10)
- # reagent (12)
- # ring (27)
- # ring-swagger (3)
- # rum (2)
- # slack-help (1)
- # spacemacs (134)
- # specter (6)
- # sql (15)
- # testing (20)
- # uncomplicate (5)
- # unrepl (49)
- # untangled (9)
- # yada (29)
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.
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).
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.
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