This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-01
Channels
- # arachne (3)
- # bangalore-clj (8)
- # beginners (9)
- # cljsrn (3)
- # clojure (148)
- # clojure-filipino (2)
- # clojure-russia (25)
- # clojure-serbia (3)
- # clojure-spec (14)
- # clojure-uk (61)
- # clojureremote (7)
- # clojurescript (38)
- # clojurewest (2)
- # cursive (2)
- # data-science (9)
- # datomic (4)
- # emacs (4)
- # jobs (6)
- # lein-figwheel (3)
- # leiningen (2)
- # off-topic (1)
- # om (3)
- # onyx (1)
- # pedestal (16)
- # perun (2)
- # powderkeg (1)
- # protorepl (2)
- # re-frame (1)
- # reagent (10)
- # spacemacs (2)
- # unrepl (5)
- # untangled (4)
Hello !
I have a set of keywords like (def ks #{::email ::password})
and I would like to build a spec from it, like
(s/def ::cred
(s/keys :req-un (into [] ks)))
But s/keys
and s/def
are macros so (into [] ks)
is not evaluated… So I tried
(s/def ::cred
`(s/keys :req-un [~@ks]))
But the inner part seems to not be expanded and passed "as is" to s/def
. I have a feeling telling me that I'm doing something wrong here. Is it sane ? Is there a way to expand the body before s/def
is called ?You have to write your own macro
A one that wrap s/def
and s/keys
?
Ah ! I get it ! Sorry for that 😕 Thank you !
Hi! Sorry for dumb question, but how i can run my spec tests as unit tests using clojure.test? My goal is to run tests in some CI tool using lein test.
@mike1452 write a regular test that calls spec and asserts about the response
@gfredericks is it right solution? http://middlesphere-1.blogspot.ru/2017/04/clojuretest-with-clojurespec.html
Looks plausible
hello all, having a little trouble getting up and running with clojure.spec in clojurescript have these dependencies in my project.clj
[ [org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.494"]
[org.clojure/core.async "0.2.391"]
...
[org.clojure/test.check “0.9.0”] ]
and my namespace looks like
(ns foo.core
(:require [cljs.spec :as s]
[clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop :include-macros true]))
with all that the following doesnt work it throws an error
(s/def ::node
(s/or
:leaf int?
:branch (s/coll-of ::node :min-count 1 :max-count 2)))
(js/console.log (s/exercise ::node))
let me know if you can spot the error, much appriciate
tldr; the generator doesnt work which works in clj and does not work in cljs, not sure why or what im missing