I'd imagine you should be using with-bindings: user=> (ns foo) nil foo=> (defn bar [x] (inc x)) #'foo/bar foo=> (ns user) nil user=> (foo/bar 5) 6 user=> (with-bindings {#'foo/bar #(dec %)} (foo/bar 5)) 4
On Mar 17, 3:12 pm, Martin Hauner <martin.hau...@gmx.net> wrote: > Hi, > > I trying to use clojure.contrib.mock. It says to override the function > report-problem to > integrate it into other test framework like clojure.test. > > I've got this working, but the namespace switching looks a bit ugly. > Is there a better > way to handle this? Maybe something like > > (ns clojure.contrib.mock > (defn... the override) > ) > > which avoids the extra code to switch back to the original namespace? > > (ns apfloattest > (:use > apfloat > clojure.test > clojure.contrib.mock)) > > (ns clojure.contrib.mock > (:use > clojure.test)) > > ; delegate mock reporting to clojure.test > (defn report-problem > ([function expected actual message] > (is (= expected actual) > (str message " Function name: " function)))) > > (ns apfloattest) > > (deftest test-sqrtf > (expect [apf (times 1 (returns (apf 5)))] (sqrtf 5))) > > -- > Martin -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.