Fork me on GitHub
#clojure-spec
<
2016-08-02
>
lvh02:08:48

@gfredericks: I don’t know if you’re interested in adding me as a contributor to schpec, but I’d be happy to add e.g. CI and review PRs.

jstokes02:08:09

is there a test runner for specs now? the documentation for fdef references clojure.spec.test/run-tests but I can't seem to find that function

seancorfield04:08:42

@jstokes: The short answer is "no". Rich has talked about this on the mailing list and in the Cognicast and it sounds like they want clojure.spec to be test tool neutral. You can already use it with clojure.test, Expectations, etc however you want so you can use your existing test runner setup if you want. But clojure.spec is kind of different to regular tests...

seancorfield04:08:22

...you may well want to (instrument) your application while running your normal test suite or even while just developing...

seancorfield04:08:23

...but generative tests don't always fit in with fast-running "unit" style tests so you probably don't want to just run those in amongst your regular tests.

jstokes13:08:49

@seancorfield: thanks! that makes a lot of sense

jstokes13:08:38

i noticed that some of my specs do take a while to run, so probably dont want that included in my normal cider-test workflow

glv13:08:35

What I’ve always wanted with test.check is a nice way to run the generative tests as part of the usual unit-test suite, but with a much smaller number of tests. And then run them separately with the full deal.

glv13:08:02

(1000 tests is nicely exhaustive; 25 is a decent sanity check.)

glv13:08:28

I suspect there’s a way to do that that I haven’t figured out yet.

glv13:08:48

Ah, nice. Thanks!

jstokes14:08:08

how would you use test.chuck with specs? clojure.spec.test/check returns the check results, not something you can plug in to defspec, right?

gfredericks15:08:16

you'd probably reimplement something similar that passes num-tests to clojure.spec.test/check

jstokes15:08:08

ah ok, i didn’t know if that was already in place

gfredericks15:08:42

something like that could be added to schpec

lvh16:08:53

I’m writing stuff that produces (s/and …) specs and generates a pred for it; I’d like to make the error message more useful. Right now it just says something silly like:

{:clojure.spec/problems
             ({:path [:test-schema.root/item-0],
               :pred (subset? (set (keys %)) all-props),
               :val {:a 1},
               :via [:test-schema/root :test-schema.root/item-1],
               :in []})}
all-props is a set. It’d be much more useful if it showed the actual set. s/and inspects the form, so I can’t quite figure out how to do that — eval doesn’t quite work because then you get the ugly syntax-quoted form

lvh16:08:24

how can I communicate the value of all-props for when it fails? Write my own Spec impl?

gfredericks22:08:09

bsima: def is a special form, you can't exclude it

glv22:08:57

In that case, does having it in the exclude clause have any effect?

gfredericks23:08:18

not that I know of

gfredericks23:08:37

exclude is silent when the thing doesn't exist