This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-21
Channels
- # beginners (165)
- # boot (9)
- # cider (9)
- # cljs-dev (5)
- # cljsjs (5)
- # clojars (4)
- # clojure (207)
- # clojure-brasil (1)
- # clojure-greece (3)
- # clojure-poland (2)
- # clojure-russia (6)
- # clojure-spec (85)
- # clojure-taiwan (1)
- # clojure-uk (53)
- # clojurescript (96)
- # community-development (2)
- # cursive (4)
- # datomic (14)
- # emacs (41)
- # events (2)
- # hoplon (184)
- # leiningen (1)
- # nginx (1)
- # off-topic (16)
- # om (7)
- # onyx (63)
- # pedestal (27)
- # planck (17)
- # protorepl (3)
- # rdf (9)
- # re-frame (62)
- # reagent (7)
- # ring-swagger (5)
- # schema (2)
- # spacemacs (5)
- # test-check (25)
- # untangled (93)
- # yada (3)
just added the result-data feature to master: https://github.com/clojure/test.check/commit/95112167af9636a48d3174ddd03409e8ac752179
@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
to be discussed
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
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
are you going to be at the conj?
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
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.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