Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Clear cache in teardown method of MemoizedFixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Sierra committed Aug 15, 2010
1 parent 0bea24c commit 3ebf3ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/clojure/lazytest/fixture.clj
Expand Up @@ -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)))
Expand Down

0 comments on commit 3ebf3ed

Please sign in to comment.