On Nov 28, 2014, at 12:59 PM, Brian Marick <[email protected]> wrote:
> A Midje user reports a bug that is actually a Clojure behavior. Does it count
> as a bug?
If you're mocking a function that is specifically declared to take a long
(primitive), shouldn't the mocked call also be declared to take a long?
(defn test-fn [^long x] x) ; Note hint
#'user/test-fn
(defn do-something [x] (test-fn x))
#'user/do-something
(with-redefs [test-fn (fn [^long x] (prn :x x) x)] ; Note hint here too!
(do-something "non-int"))
And this fails (as expected):
ClassCastException java.lang.String cannot be cast to java.lang.Number
user/do-something (form-init1785865955014487522.clj:1)
Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
--
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.