On Sep 27, 9:18 pm, John Harrop <jharrop...@gmail.com> wrote:
> Isn't (binding [foo bar] ...) already such a mechanism? Or does the
> "fixtures" feature let you specify such a binding for a whole group of tests
> obviating the need to repeat the binding form in multiple test functions,

Yes.  A fixture is a function that takes another function as its
argument.  It can alter the environment in which tests are run.  Like
this:

(defn my-fixture [f]
  (...setup, bindings, whatever...
     (f)
     ... teardown, whatever...))

The "use-fixtures" function configures fixtures to run once per test
or once per namespace.

> and perhaps let mutable state carry forward through multiple tests instead
> of being rebound (and thus reset) after each one?

You could do this, but you still can't control the order in which
tests are run.  If things need to happen in a particular order, you
either need to use nested tests functions or one large function.

-SS
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to