This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-22
Channels
- # beginners (43)
- # bristol-clojurians (2)
- # calva (11)
- # cider (10)
- # clj-kondo (3)
- # clojars (19)
- # clojure (93)
- # clojure-france (44)
- # clojure-nl (10)
- # clojure-uk (15)
- # clojuredesign-podcast (1)
- # clr (6)
- # core-typed (102)
- # data-science (1)
- # datomic (11)
- # docker (4)
- # emacs (12)
- # fulcro (27)
- # graalvm (6)
- # joker (1)
- # leiningen (4)
- # lumo (20)
- # nrepl (3)
- # off-topic (63)
- # parinfer (4)
- # reagent (40)
- # remote-jobs (2)
- # shadow-cljs (18)
- # spacemacs (7)
- # tree-sitter (7)
- # yada (3)
I’ve been looking at irritations with testing recently and wondering if there’s a decent out of the box solution for this. On test failure, you get something like this:
Error: Assert failed: (<= -4 (:morale kingdom) 4)
Whereas I’d like to know the value of (:morale kingdom)
, as the automatic next step is pulling out that value… (This is in figwheel, though there’s no reason I couldn’t be writing this in clojure if there’s better tooling there…)
Anyone have any good suggestions?Sorry @dominicm, what do you mean? Should I be wrapping (<= -4 (:morale kingdom) 4)
as a function?
Yeah. So you'd have something like:
(defn valid-morale?
[morale]
(<= -4 morale 4))
Then
(is (valid-morale? (:morale kingdom)))
If it fails, you will get a useful message.