Iiinteresting. It turns out that I wasn't calling (x) in the :once code. It
looks like that prevents :each test from running.


(ns utest)
(use 'clojure.test)

(defn f [x] (println "f before") (x) (println "f after"))
(use-fixtures :each f)

(defn g [x] (println "g1") *(x)* (println "g2"))
(use-fixtures :once g)

(deftest test-me (is ( = 1 1)))
(deftest test-me-2 (is ( = 2 2 )))

(run-tests)


Thanks
Tim


On Fri, Oct 1, 2010 at 2:17 PM, Timothy Washington <twash...@gmail.com>wrote:

> Hmmm, I'm using clojure 1.2. I'll try out 1.3 when I get home.
>
> Thanks
> Tim
>
>
> On Thu, Sep 30, 2010 at 10:09 PM, Sean Corfield <seancorfi...@gmail.com>wrote:
>
>> On Thu, Sep 30, 2010 at 2:44 PM, Timothy Washington <twash...@gmail.com>
>> wrote:
>> > Just in case anyone comes across this, I did get around it. In fig. 2 I
>> was
>> > trying to run (use-fixtures) twice. One with a :once, and one with
>> :each.
>>
>> I just tried that and it worked fine for me:
>>
>> (ns utest)
>> (use 'clojure.test)
>> (defn f [x] (println "f before") (x) (println "f after"))
>> (use-fixtures :each f)
>> (defn g [x] (println "g1")(x)(println "g2"))
>> (use-fixtures :once g)
>> (deftest test-me (is ( = 1 1)))
>> (deftest test-me-2 (is ( = 2 2 )))
>> (run-tests)
>>
>> Produced:
>>
>>
>> Testing utest
>> g1
>> f before
>> f after
>> f before
>> f after
>> g2
>>
>> Ran 2 tests containing 2 assertions.
>> 0 failures, 0 errors.
>> {:type :summary, :pass 2, :test 2, :error 0, :fail 0}
>>
>> I'm using Clojure 1.3.0 master.
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> Railo Technologies, Inc. -- http://getrailo.com/
>> An Architect's View -- http://corfield.org/
>>
>> "If you're not annoying somebody, you're not really alive."
>> -- Margaret Atwood
>>
>> --
>> 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<clojure%2bunsubscr...@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 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