diff --git a/pom.xml b/pom.xml index 9b49ce4..baceadf 100644 --- a/pom.xml +++ b/pom.xml @@ -3,10 +3,10 @@ 4.0.0 atticus atticus - 0.1.0-SNAPSHOT + 0.1.1-ANNADALE Atticus mock and test helpers Mocking library and test helpers - http://github.com/hugoduncan/atticus + http://github.com/m-dec/atticus @@ -62,17 +62,22 @@ org.clojure clojure - 1.2.0 + 1.3.0 + org.clojure - clojure-contrib - 1.2.0 + tools.logging + 0.2.3 swank-clojure swank-clojure - 1.2.1 + 1.3.0 true diff --git a/src/main/clojure/atticus/mock.clj b/src/main/clojure/atticus/mock.clj index de4e34e..018a497 100644 --- a/src/main/clojure/atticus/mock.clj +++ b/src/main/clojure/atticus/mock.clj @@ -20,13 +20,13 @@ lambda. " (:use clojure.test)) -(def *expectations*) +(def ^:dynamic *expectations*) (defn equality-checker [actual expected msg] (is (= actual expected) msg)) -(def *equality-checker* equality-checker) +(def ^:dynamic *equality-checker* equality-checker) (defn verify-expectations [checks] @@ -123,7 +123,7 @@ lambda. "Binds a list of mocks, checling any expectations on exit of the block." [mocks & body] `(with-expectations - (binding ~(construct-bindings mocks) + (with-redefs ~(construct-bindings mocks) (let ~(construct-protocol-bindings mocks) ~@body)) (verify-expectations *expectations*))) diff --git a/src/main/clojure/atticus/utils.clj b/src/main/clojure/atticus/utils.clj index 93ac629..0bbe903 100644 --- a/src/main/clojure/atticus/utils.clj +++ b/src/main/clojure/atticus/utils.clj @@ -1,6 +1,6 @@ (ns atticus.utils (:require - [clojure.contrib.logging :as logging]) + [clojure.tools.logging :as logging]) (:use clojure.test)) (defmacro with-private-vars [[ns fns] & tests] diff --git a/src/test/clojure/atticus/mock_test.clj b/src/test/clojure/atticus/mock_test.clj index fd72f3a..d4d0529 100644 --- a/src/test/clojure/atticus/mock_test.clj +++ b/src/test/clojure/atticus/mock_test.clj @@ -1,20 +1,21 @@ (ns atticus.mock-test (:use atticus.mock :reload-all) - (:use clojure.test) - (:require - [clojure.contrib.condition :as condition])) + (:use clojure.test)) + +;;; unmaintained condition lib removed here +;;; considering slingshot or simply (is (thrown-with-msg? ...)) (deftest verify-expectations-test (is (thrown? - clojure.contrib.condition.Condition - (verify-expectations [(fn [] (condition/raise :error 1))]))) + Exception + (verify-expectations [(fn [] (throw (Exception. "error 1")))]))) (is (nil? (verify-expectations [(fn [] true)])))) (defn equality-condition [a b msg] (when-not (= a b) - (condition/raise :message msg))) + (throw (Exception. msg)))) (deftest add-expectation-test (with-expectations @@ -26,14 +27,14 @@ (with-expectations (let [f (once v1 [] (once 1))] (is (thrown? - clojure.contrib.condition.Condition + Exception ((first *expectations*)))) (is (= 1 (f))) (is (nil? ((first *expectations*)))))) (with-expectations (let [f (once v1 [x] (once (inc x)))] (is (thrown? - clojure.contrib.condition.Condition + Exception ((first *expectations*)))) (is (= 1 (f 0))) (is (nil? ((first *expectations*)))))))) @@ -43,7 +44,7 @@ (with-expectations (let [f (times v1 [x] (times 2 (inc x)))] (is (thrown? - clojure.contrib.condition.Condition + Exception ((first *expectations*)))) (is (= 1 (f 0))) (is (= 2 (f 1))) @@ -51,7 +52,7 @@ (with-expectations (let [f (times v1 [x] (times 2 (inc x)))] (is (thrown? - clojure.contrib.condition.Condition + Exception ((first *expectations*)))) (is (= 1 (f 0))) (is (= 2 (f 1))) diff --git a/src/test/clojure/atticus/utils_test.clj b/src/test/clojure/atticus/utils_test.clj index 05f022a..7939e10 100644 --- a/src/test/clojure/atticus/utils_test.clj +++ b/src/test/clojure/atticus/utils_test.clj @@ -1,8 +1,7 @@ (ns atticus.utils-test (:use atticus.utils :reload-all) - (:use clojure.test) - (:require - [clojure.contrib.condition :as condition])) + (:use clojure.test)) + (deftest tmpfile-test (let [t (tmpfile)] @@ -16,7 +15,7 @@ (.delete t))) -(def *fn*) +(def ^:dynamic *fn*) (deftest with-temporary-file-test (binding [*fn* nil]