This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-25
Channels
- # announcements (2)
- # babashka (22)
- # beginners (31)
- # calva (4)
- # cider (26)
- # clj-kondo (10)
- # clojure (32)
- # clojure-europe (1)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-spec (16)
- # clojure-switzerland (5)
- # clojure-uk (25)
- # clojurescript (108)
- # clojutre (15)
- # code-reviews (3)
- # data-science (1)
- # datomic (92)
- # emacs (1)
- # fulcro (8)
- # graalvm (8)
- # jackdaw (8)
- # jobs (1)
- # jobs-discuss (1)
- # leiningen (6)
- # off-topic (56)
- # pathom (6)
- # pedestal (5)
- # re-frame (11)
- # remote-jobs (1)
- # shadow-cljs (4)
- # spacemacs (2)
- # sql (41)
- # tools-deps (7)
- # xtdb (25)
I’ve got a question about spec2, how do I do something like this:
(s/def ::foo (partial bar 1))
- in spec2 that fails. Wrapping the partial in e.g. s/spec is no solution.
I believe function literals are accepted @sundbp -- try (s/def ::foo #(bar 1 %))
Yeah, that works:
user=> (require '[clojure.spec-alpha2 :as s])
nil
user=> (defn bar [n y] (< n y))
#'user/bar
user=> (s/def ::foo #(bar 1 %))
:user/foo
user=> (s/conform ::foo 2)
2
user=> (s/conform ::foo 1)
:clojure.spec-alpha2/invalid
user=>
I can dig into the implementation and find out, but does anyone happen to know whether test.check/quick-check calls clojure.test/is or clojure.test/are internally, and thus is intended to be called inside of a clojure.test/deftest form directly?
The doc string says it runs multiple tests, but isn't clear about whether there is a return value
Perhaps one reasonable way to use test.check/quick-check inside of a clojure.test/deftest would be (is (:pass? (test.check/quick-check ...)))
?
Ah, from looking at test.check's own deftest's, it appears that it often uses (is (:result (test.check/quick-check ...)))
. I will use that, too.
Is there some existing test.check docs that describe the return value of quick-check that I could learn this from? Or perhaps a small addition to the quick-check doc string might be welcome?
The docstring of the latest version is pretty explicit about the return value
You're correct that the quickcheck function is unrelated to clojure.test; you can integrate manually as you noted, or by using the t.c.clojure-test namespace
ok, I may have been checking the quick-check doc string of an older version that core.rrb-vector is using. Let me look at the latest.
The past was a terrible time
OK, much better now. Thanks!