Fork me on GitHub
#lumo
<
2017-12-08
>
anmonteiro00:12:22

test.check is not bundled with Lumo

anmonteiro00:12:34

no plans to bundle it either

hlolli10:12:49

maybe there are plans to make spec not depend on test.check, as far as I see, cljs.spec.test/instrumentation should be highly encouraged to be used.

dominicm10:12:34

I'm casting my mind quite far back here, but I seem to recall the dependency being optional.

dominicm10:12:46

Unless you wanted to use feature X

hlolli12:12:11

cljs.spec.test.alpha/instrument needs clojure.test.check, strangely.

hlolli12:12:35

or the whole spec.test, like I wrote above.

richiardiandrea18:12:08

Yes, that is a ClojureScript requirement....

johnjelinek22:12:20

why no plans to bundle it?

mfikes22:12:21

I've also resisted bundling it with Planck—it is not part of ClojureScript proper and it has its own independent release cycle.

mfikes22:12:56

As a counter argument, where do you stop? Should Andare be bundled, etc.?

mfikes22:12:58

One place that I've made an exception is for Replete, where you have no choice. (It also seems to fit with the app's name, having it bundle lots of libs 🙂 )

mfikes22:12:32

@hlolli The reason you need test.check for instrument is perhaps best explained with a concrete example. But the general idea is that it needs to generate values to pass to speced higher order functions. Example:

cljs.user=> (require '[clojure.spec.alpha :as s])
nil
cljs.user=> (s/def ::foo (s/fspec :args (s/cat :x int? :y string?)))
:cljs.user/foo
cljs.user=> (defn some-foo [x y] (prn x y))
#'cljs.user/some-foo
cljs.user=> (defn bar [foo z] (prn z))
#'cljs.user/bar
cljs.user=> (s/fdef bar :args (s/cat :foo ::foo :z int?))
cljs.user/bar
cljs.user=> (require '[clojure.spec.test.alpha :as st])
nil
cljs.user=> (st/instrument)
[cljs.user/bar]
cljs.user=> (bar some-foo 3)
0 ""
-1 ""
0 "7"
1 "iet"
0 "P"
6 "T33"
3 "L"
-6 "fu775"
0 "2v9K655S"
-118 "7G3"
-2 "52q"
-51 "6f37zW351"
5 "934"
-4046 "087Fd"
0 "94Y3oMjl"
-1 "0e02j0kH3o45"
-323 "A8saPQ74W7kv5u6"
29 "T6fZD973dfJ"
189 "30ZBgZ27Xn"
5056 ""
-794 "bJf9MRNBtZBCxW5rN7p"
3
nil

hlolli00:12:37

Surprised and confused about how instrument works. I thought the goal was to alert the user that he provided arguments in runtime that defy the spec.

mfikes22:12:39

If this surprises you, it did me as well, and Alex gave some insight https://clojurians-log.clojureverse.org/clojure-spec/2017-06-06.html