This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-21
Channels
- # bangalore-clj (1)
- # beginners (60)
- # boot (30)
- # cider (7)
- # cljs-dev (10)
- # cljsrn (2)
- # clojure (163)
- # clojure-conj (10)
- # clojure-france (1)
- # clojure-greece (2)
- # clojure-italy (7)
- # clojure-russia (41)
- # clojure-serbia (22)
- # clojure-spec (41)
- # clojure-uk (41)
- # clojurescript (178)
- # cursive (36)
- # datascript (1)
- # datomic (23)
- # dirac (38)
- # graphql (12)
- # hoplon (20)
- # immutant (32)
- # instaparse (3)
- # keechma (1)
- # lein-figwheel (18)
- # leiningen (8)
- # liberator (1)
- # luminus (30)
- # lumo (29)
- # off-topic (18)
- # om (17)
- # pedestal (7)
- # planck (37)
- # precept (1)
- # re-frame (67)
- # ring-swagger (2)
- # timbre (1)
- # untangled (8)
- # vim (2)
i.e. is it intended that I could use the :default
implementation to provide a default spec? https://gist.github.com/bhb/7eefe3034a0622b6499a5b5dd2f7e52a
yes, this should work (it does in Clojure)
so, that's a bug in cljs spec
actually, that's already been fixed if you update your cljs version
@alexmiller Ah, shoot, I should have checked JIRA. Thanks for the info!!!
Is there a currently recommended way to integrate clojure.spec
s generative testing with clojure.test
?
royalaid: I wrote a similar macro for fdef
which is basically a simplification of that one. Here it is:
(defmacro defspec-test
([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil))
([name sym-or-syms opts]
`(t/deftest ~name
(let [check-results# (clojure.spec.test/check ~sym-or-syms ~opts)]
(doseq [result# check-results#]
(t/is (nil? (:failure result#)) (str (clojure.spec.test/abbrev-result result#)))
(when (nil? (:failure result#))
(println "[OK] - " (clojure.spec.test/abbrev-result result#))))))))
you would use it like this: https://github.com/n7a235/data.hypobus/blob/dev/test/hypobus/basic_test.clj#L27
I have found this https://stackoverflow.com/questions/40697841/howto-include-clojure-specd-functions-in-a-test-suite
@royalaid I can't speak to clojure.spec, but with test.check I use test.chuck, which has a macro checking
that behaves similar to testing
I'd link you to it except slack's electron app decided I can't use my clipboard anymore
Hi all. started using spec in cljs today. I am running into a weird issue
(ns tenandsix.app.flow
(:require-macros [cljs.spec :as s])
(:require [cljs.spec :as spec]))
(s/def :flow/action-type keyword?) => works
(s/def :flow/action (s/tuple keyword? keyword?)) => No such namespace: s, could not locate s.cljs, s.cljc, or Closure namespace ""
no that was actually me testing if the keyword made a difference 🙂
but no that does not fix it
any thoughts? I mean this is as basic as it gets
https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/spec/alpha.cljc#L395
it is yes.
so actually. it works, but my repl gives the error, when I use the spec it works
I'll try again
1. evaluating that actually creates the spec
2. I can use the spec
3. It gives the error when I create the spec
checking the link
@dpsutton thanks your link helped
thats a pretty big improvement
what's the cleanest way to make a generator that constantly returns the same value? Similar to constantly
in core?
I came up with this, which works. I just wanted to make sure I wasn't missing an easier way
#(gen/fmap (constantly 1)
(gen/int))
@adamfrey (gen/return 1)
probably with an extra #
in a spec context
@adamfrey I would say (s/gen #{1})