Fork me on GitHub

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


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


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


I'll make sure that happens


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


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


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


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


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
    (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.


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


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


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


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)


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


which I can't guess at, not knowing midje


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. 🙂


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