This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-29
Channels
- # bangalore-clj (2)
- # beginners (22)
- # boot (28)
- # cljs-dev (91)
- # cljsrn (4)
- # clojure (30)
- # clojure-austin (8)
- # clojure-conj (4)
- # clojure-japan (1)
- # clojure-russia (3)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (42)
- # cursive (2)
- # editors (1)
- # hoplon (16)
- # klipse (91)
- # lein-figwheel (1)
- # luminus (9)
- # off-topic (4)
- # om (83)
- # onyx (29)
- # perun (6)
- # re-frame (17)
- # spacemacs (6)
- # untangled (1)
- # vim (5)
I have zipper data structure using the techniques described in http://puredanger.github.io/tech.puredanger.com/2010/10/22/zippers-with-records-in-clojure but I’m finding it hard to write a spec that validates child nodes using the protocol. I can’t use a map key because different impls of TreeNode (Zippable in my case) may use different keys. I’ll paste an e.g. next....
Is there an easy way to figure out which spec in a large nested spec that is causing "ExceptionInfo Couldn't satisfy such-that predicate after 100 tries." when using (s/exercise ...)
?
usually it’s down to a string or something that has lots of constraints put on it and is difficult to generate reliably, but you probably already know about that; one gotcha that i don’t think is as well-known is that if you have a coll-of that’s got a :kind set?
but doesn’t have an into #{}
, that can cause the same couldn’t-satisfy-after-100-tries behavior
might not be your issue, but i always feel compelled to mention it when people have this problem because it happened to me and took me a while to figure out
Ah, good tip on the set thing, I haven't run into that yet, but I could see making that mistake.
It doesn't really help you but I highly recommend trying to s/exercise
each spec as you write it and build up complex specs in terms of other specs (not just predicates).
Predicates tend to be opaque when you combine them into specs. If you define specs for those predicates, when you combine the specs, you get better error reporting.