This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-10
Channels
- # announcements (2)
- # beginners (37)
- # boot (1)
- # cider (76)
- # clara (14)
- # cljs-dev (132)
- # cljsjs (1)
- # cljsrn (2)
- # clojure (18)
- # clojure-colombia (5)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (2)
- # clojure-nl (8)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (85)
- # clojurescript (84)
- # code-reviews (25)
- # cursive (10)
- # data-science (3)
- # datomic (30)
- # editors (1)
- # emacs (3)
- # fulcro (106)
- # graphql (4)
- # hyperfiddle (26)
- # jobs (2)
- # jobs-discuss (124)
- # keechma (3)
- # leiningen (1)
- # lumo (6)
- # off-topic (5)
- # other-lisps (5)
- # reagent (5)
- # ring-swagger (4)
- # shadow-cljs (140)
- # spacemacs (22)
- # specter (2)
- # sql (48)
- # tools-deps (78)
- # vim (7)
What's a good way to kind of namespace specs internal to a file? So the issue is that s/keys
needs to have a spec named, say foo
So I would do ::foo
. However, my function returns a modified map, hence the :ret
also has to be something that has s/keys
with ::foo
And many functions in that file return modified maps
So I kind of want to namespace the spec for this function
I'm now doing :function-name-pre/foo
Anyone has a better solution?
The s/keys
already spec it as unqualified
Because of that
The actual key has to have a name that matches the key in the map that is specced
Thanks! Haha
Maybe in short it's "how do you group specs for a function?"
@ackerleytng I'm not sure I understand the problem you think you have... why does :ret
come into this and cause you a problem?
Perhaps if you shared a concrete example?
Sure hmm I'll work one out and post it later
I don't believe so but there's a function s/invalid?
you can use to test for that value.
(that said, I've written conforming predicates that return either an updated value or ::s/invalid
a few times so...)
I have a spec that checks that one of the keys is a core.async channel; I’d like to write a custom generator for that specific key spec, but I can’t seem to determine how to write a generator that returns a channel; I feel like I’m missing something obvious here
can you use http://clojure.github.io/test.check/clojure.test.check.generators.html#var-return
thanks @seancorfield
yes, ::s/invalid is part of the public api @bja @seancorfield
Thanks for the clarification @alexmiller!