creates the count checker that is invoked at the end of an expectation, after
the code under test has all been executed. The function returned takes the
name of the associated dependency and the invocation count as arguments.
(defn make-count-checker
"creates the count checker that is invoked at the end of an expectation, after
the code under test has all been executed. The function returned takes the
name of the associated dependency and the invocation count as arguments."
[pred pred-form]
(let [pred-fn (if (integer? pred) #(= pred %) pred)]
(fn [fn-name v] (if (pred-fn v) true
(incorrect-invocation-count fn-name pred-form v)))))
Comments top
No comments for make-count-checker. Log in to add a comment.