Skip to content
This repository has been archived by the owner on Nov 14, 2017. It is now read-only.

Args with postconditions #35

Open
neverfox opened this issue Mar 26, 2016 · 0 comments
Open

Args with postconditions #35

neverfox opened this issue Mar 26, 2016 · 0 comments

Comments

@neverfox
Copy link

The examples in the docs imply that postcondition handlers will receive args, but that doesn't seem to be the case:

(defn add-one [n]
  (inc n))

(with-postcondition! #'add-one
                     "An optional docstring."
                     ;;; Name of the postcondition
                     :not-two
                     (fn [n & args]
                       (println args)
                       (not= n 2)))

(with-handler! #'add-one
               {:postcondition :not-two}
               (fn [e result] (str "Postcondition failed for result: " result)))

(add-one 1)
nil
=> "Postcondition failed for result: 2"

Also the downstream with-handler! handler doesn't get them either, in this case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant