This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-12
Channels
- # aleph (1)
- # beginners (81)
- # boot (20)
- # cider (46)
- # cljs-dev (6)
- # cljsjs (6)
- # cljsrn (8)
- # clojars (2)
- # clojure (104)
- # clojure-berlin (3)
- # clojure-italy (4)
- # clojure-losangeles (2)
- # clojure-nl (16)
- # clojure-spec (16)
- # clojure-uk (28)
- # clojurescript (88)
- # core-logic (31)
- # cursive (8)
- # data-science (3)
- # datascript (1)
- # datomic (95)
- # docs (1)
- # emacs (6)
- # figwheel-main (24)
- # fulcro (106)
- # graphql (5)
- # hyperfiddle (2)
- # midje (2)
- # nrepl (1)
- # off-topic (14)
- # om-next (1)
- # parinfer (2)
- # pedestal (26)
- # portkey (2)
- # re-frame (11)
- # reagent (27)
- # ring (6)
- # rum (4)
- # shadow-cljs (33)
- # spacemacs (10)
- # specter (53)
- # tools-deps (17)
- # vim (31)
Is there any way to use predicates inside the literal comparator to achieve something like this in spec.
(s/valid? #{["foo" "bar" string?]} ["foo" "bar" "baz"])
so (s/tuple #{"foo"} #{"bar"} string?)
? but if I wanted to combine that with other fixed values where I know all 3 elements, I'd have to use an s/or like so?
(s/or :set #{["a" "b" "c"]} :tuple (s/tuple #{"foo"} #{"bar"} string?))
There is no way to next dynamic values inside the #{}
Thanks btw 🙂 jut wanted to check my understanding.
Yeah I have a set of triple store values, most are known but for some subset the final key is freetext.
Is there a way to override key-specs in test like it is possible for fn-specs with instrument
?
I don’t see :overrides in the doc string of instrument
. I also don’t see a possibility to override key-specs.
https://clojure.github.io/spec.alpha/clojure.spec.test.alpha-api.html#clojure.spec.test.alpha/instrument You cannot override key specs. You can only override which specs are bound to particular functions, and which generators are used for particular specs
Overriding the key spec doesn't really make sense conceptually -- you'd be changing the contract but preserving the same global name
I have a function which gets a map of values and I don’t like to generate the real values in test. So I would like to override the specs for the keys in the map. But if I think more about it, why should a supply a map to the function at all? So I can change the fn-spec to take a custom test value instead of a map which custom test values in it. That should work. Oh I also stub the function.