I cannot find out a way to 'turn on' >fdef
, what am I doing wrong?
(ns test-ghostwheel.events
#:ghostwheel.core{:check true
:num-tests 10}
(:require
[re-frame.core :as re-frame]
[clojure.core :as c]
[cljs.spec.alpha :as s]
[cljs.spec.test.alpha :as stest]
[ghostwheel.core :as g
:refer [>defn >defn- >fdef => | <- ?]]
[test-ghostwheel.db :as db]
))
(re-frame/reg-event-db
::initialize-db
(fn [_ _]
db/default-db))
(>fdef c/max
[x & more]
[number? (s/* number?) => number?])
(>fdef c/count
[x]
[(? (some-fn seqable? counted?)) => nat-int?])
(defn addition
[a b]
(+ a b))
(>fdef addition
[a b]
[pos-int? pos-int?
=> int? | #(> % a) #(> % b)])
(g/check)
Browser console says 'No active tests found'
@armikhalev
>fdef
is meant to be used for spec-instrumentation of external libraries/namespaces where you don't write the function code yourself. In Ghostwheel only >defn
generates tests when you properly define the specs inline.
(And on a side note – re-frame is a great choice to use with Ghostwheel because of the ability to have pure events, which are perfect for generative testing.)
Thank you for explanation, I somehow didn't catch that. I have a case where I can't use >defn
macro because I already use a macro for the function. I'm using re-frame-10x library for tracing data, it requires macro as per https://github.com/Day8/re-frame-10x/blob/master/docs/HyperlinkedInformation/EventCodeTracing.md
So, it might be that I can just live without that, I would prefer having my functions speced, but it would be nice to have.
@armikhalev I'll give this some more thought, but in the meantime I can point you to Ghostwheel's own tracing functionality, which you could use instead: https://github.com/gnl/ghostwheel#evaluation-tracing-and-program-observability
You can still use re-frame-10x for high level event tracing and use Ghostwheel for low-level in-depth tracing of single functions.
Thanks, overall I'm pretty much satisfied with Ghostwheel's tracing, not much need of 10x, just for the future, it might be worth to investigate this problem further.
Yup, it's not a priority but I will put it on the list. For now I think re-frame-10x and Ghostwheel can complement each other quite nicely, but we'll see how well that works in practice over a longer period and if any issues pop up.