Also, I came up with a solution for simple around-each fixtures. It would use a declarative style just like (defn ^:test ...), but it would be (defn ^:around-each ...). And its metadata would contain a matcher-fn that matches against a test-fn's metadata.
This way you could define a bunch of tests marked ^:db, and have an around-each fixture with :db as its matcher. The de-coupling means you don't need grouping or nesting to have multiple fixtures applied to multiple tests. It also means you can specify both tests and fixtures on a per-feature level. Unfortunately this solution does't carry over to around-all fixtures, because if several tests belong to multiple around-all fixtures, and not the same ones either, they would have to be run multiple times. On Wed, Jul 24, 2013 at 10:17 AM, Steven Degutis <sbdegu...@gmail.com>wrote: > The vast majority of my tests look like: do some setup, do some action, > make a half-dozen assertions. Almost always in that order. > > The only reason I can think of that I would need to have assertions in the > middle is if I plan to do more setup and action and assertions afterwards. > > And in that case, I'm really just writing a second test that should > probably be its own test-fn. And if it relies on the setup from the first > test, I should probably just extract it out into a function with common > setup. > > I think I'm almost sold on this idea now. > > > On Wed, Jul 24, 2013 at 10:07 AM, John D. Hume > <duelin.mark...@gmail.com>wrote: > >> I've never tried it, but I like the idea of test fns returning their >> results. >> >> On Jul 24, 2013 8:30 AM, "Steven Degutis" <sbdegu...@gmail.com> wrote: >> > >> > Also, I've been considering having a non-side-effecty way of returning >> test results. What do people think? It would get rid of the last bit of >> magic in the lib. >> > >> > >> > ;; current style (side-effecty) >> > >> > (defn test-1 [] >> > (let [foo (get-foo)] >> > (expect empty? foo) >> > (expect awesome? foo))) >> > >> > ;; proposed style (more functional) >> > >> > (defn test-1 [] >> > (let [foo (get-foo)] >> > [(expect empty? foo) >> > (expect awesome? foo)])) >> > >> >> -- >> -- >> 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 >> --- >> 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 clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- -- 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 --- 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.