test-check

2016-11-21T12:58:33.000168Z

just added the result-data feature to master: https://github.com/clojure/test.check/commit/95112167af9636a48d3174ddd03409e8ac752179

✨ 1
2016-11-21T13:01:24.000169Z

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

2016-11-21T13:07:22.000170Z

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

alexmiller 2016-11-21T14:30:27.000171Z

to be discussed

alexmiller 2016-11-21T14:31:31.000172Z

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

alexmiller 2016-11-21T14:31:50.000173Z

it’s not like 1.9 is imminent or anything

2016-11-21T14:41:42.000174Z

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

alexmiller 2016-11-21T14:46:19.000175Z

are you going to be at the conj?

2016-11-21T15:32:54.000176Z

@alexmiller yep

alexmiller 2016-11-21T15:42:01.000177Z

cool, we should chat at some point

2016-11-21T16:15:11.000178Z

I'll make sure that happens

dangit 2016-11-21T19:25:04.000179Z

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

2016-11-21T19:32:43.000180Z

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

2016-11-21T19:33:13.000181Z

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

2016-11-21T19:33:29.000182Z

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

dangit 2016-11-21T19:41:31.000183Z

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.

2016-11-21T19:52:01.000184Z

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

2016-11-21T19:52:30.000185Z

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

2016-11-21T19:52:40.000186Z

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

2016-11-21T19:53:37.000187Z

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)

2016-11-21T19:53:52.000188Z

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

2016-11-21T19:54:08.000189Z

which I can't guess at, not knowing midje

dangit 2016-11-21T19:54:09.000190Z

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

dangit 2016-11-21T19:54:51.000191Z

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

2016-11-21T19:55:02.000192Z

np