From 3ebf3edc683ee982aed0bba0e0fffce667a10376 Mon Sep 17 00:00:00 2001 From: Stuart Sierra Date: Sun, 15 Aug 2010 19:04:18 -0400 Subject: [PATCH] Clear cache in teardown method of MemoizedFixture --- src/main/clojure/lazytest/fixture.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/clojure/lazytest/fixture.clj b/src/main/clojure/lazytest/fixture.clj index 79b6f70..09419b9 100644 --- a/src/main/clojure/lazytest/fixture.clj +++ b/src/main/clojure/lazytest/fixture.clj @@ -39,11 +39,12 @@ (setup [this] (swap! cache (fn [value] (if (= ::unset value) (f) value)))) - (teardown [this] nil)) + (teardown [this] + (reset! cache ::unset))) (defn memoized-fixture "Returns a fixture whose setup method calls, returns, and caches the - value of f. The fixture's teardown method does nothing." + value of f. The fixture's teardown method clears the cache." [f] {:pre [(fn? f)]} (MemoizedFixture. f (atom ::unset)))