On Mon, Sep 28, 2009 at 9:20 AM, Laurent PETIT <laurent.pe...@gmail.com>wrote:
> 2009/9/28 C. Florian Ebeling <florian.ebel...@gmail.com> >> >> > In Java I'd just have an interface >> > with two implementations, and bootstrap the tests with a different >> > implementation, in clojure I guess I'd do something like: >> > (in-ns `some.thing) >> > (defn foo [] nil) >> > or something? >> >> That would consitute a root binding because of the 'defn, but you need >> a dynamic rebinding. This is what you can use: >> >> (binding [existing-function (fn [a b] ...)] >> ;; your tests here >> ) >> > > But as soon as your application becomes smart enough to do things in > parallel (e.g. create and send an e-mail in a separate thread), just using > dynamic binding in tests may not be enough, still the binding will not be > seen by default by other threads. > Does "fixtures" get around that? Perhaps by saving the root binding, redef'ing it, and later restoring it? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---