Fork me on GitHub
#test-check
<
2016-11-21
>
gfredericks13:11:24

@alexmiller ⇑ that should allow clojure.spec to not need to wrap failure data in an exception

gfredericks13:11:22

actually taking advantage of that would mean that clojure.spec requires the next release of test.check; so I'm curious A) if that's reasonable, and B) if so, whether it's time for me to start panicking about finishing a test.check release before clojure-1.9 is ready

Alex Miller (Clojure team)14:11:31

I’m working hard on the build server right now, hoping to get it up to the point where I can actually build test.check normally again

Alex Miller (Clojure team)14:11:50

it’s not like 1.9 is imminent or anything

gfredericks14:11:42

Ok, I won't want to build anything for at least a week; I'm thinking of doing an alpha first, so people can use new stuff with the clojure 1.9 alphas

Alex Miller (Clojure team)14:11:19

are you going to be at the conj?

Alex Miller (Clojure team)15:11:01

cool, we should chat at some point

gfredericks16:11:11

I'll make sure that happens

dangit19:11:04

Are people using test.check and midje together? Putting a tc/defspec instead a midje/fact doesn’t seem to do much.

gfredericks19:11:43

@dangit could you share some code? I can't tell what you mean exactly

gfredericks19:11:13

I dont' know how midje integrates with clojure.test, but presumably you could intermingle those integrations

gfredericks19:11:29

defspec looks just like a regular clojure.test/deftest from clojure.test's perspective

dangit19:11:31

Yeah, I’m a bit of a newb, shoving a deftest inside a midje fact was just a guess. I tried this:

(facts "about numbers"
  (fact "a number is anything"
    4 => anything)
  (defspec inc-test
    100
    (prop/for-all [v gen/int]
                  (= (inc v) (+ 2 v)))))
hoping midje would figure out what was going on but the result is:
>>> Output from clojure.test tests:

FAIL in (inc-test) (clojure_test.cljc:21)
expected: result
  actual: false

1 failures, 0 errors.
>>> Midje summary:
All checks (1) succeeded.
Subprocess failed
So the failure triggers, but midje thinks everything is fine.

gfredericks19:11:01

defspec will only work at the top level; I don't know whether your test-runner is just clojure.test or if it's midje-specific, and that would determine whether your top-level defspec actually gets runs

gfredericks19:11:30

but if you like the nesting there's probably some way to run a generative test inside the facts macro

gfredericks19:11:40

maybe by calling clojure.test.check/quick-check directly

gfredericks19:11:37

I don't know midje but I assume in the worst case you could do something like (fact "this property holds" (boolean (:result (quick-check 100 (prop/for-all ...)))) => true)

gfredericks19:11:52

so the only question is what's the best way to make that less tedious

gfredericks19:11:08

which I can't guess at, not knowing midje

dangit19:11:09

I’m just running lein midje/using midje’s autotest. The test is definitely getting run, it just seems like a hack what I’m doing now. Calling quick-check directly is a sane idea. 🙂

dangit19:11:51

Yeah, ok, thanks! I’ll play around with it a bit more.