As noted in the alpha change list, this was an intentional change in what
instrument does. Instrument is intended to be used to verify that other
callers have invoked a function correctly. Checking that the function works
(by verifying that :ret and :fn return valid results) should be done using
one of the spec.test functions during testing.
Some other spec features are still to be added as well that relate to this
change.
On Tuesday, June 14, 2016 at 7:01:09 PM UTC-5, Alan Thompson wrote:
>
> Hi - Just noticed that the :ret function in fdef seems to be ignored in
> 1.9.0-alpha6:
>
> user=> (require '[clojure.spec :as s])
> user=> (defn dummy [x] (if x "yes" "no"))
> user=> (s/fdef dummy
> #_=> :args (s/cat :x integer?)
> #_=> :ret integer?)
> user=> (s/instrument #'dummy)
> user=> (dummy 3) (println *clojure-version*)
> ExceptionInfo Call to #'user/dummy did not conform to spec:
> val: "yes" fails at: [:ret] predicate: integer?
> :clojure.spec/args (3)
> clojure.core/ex-info (core.clj:4703)
> {:major 1, :minor 9, :incremental 0, :qualifier alpha5}
>
> ;-------------------------------------------------------------------
>
> user=> (dummy 3) (println *clojure-version*)
> "yes"
> {:major 1, :minor 9, :incremental 0, :qualifier alpha6}
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.