Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Conjure's head now works vs clojure-1.2 to 1.5alpha-3

  • Loading branch information...
commit 4a46e9403d8f779b2e1f6e862f85ea0ea086d051 1 parent 9dbd709
Alex Baranosky authored
Showing with 34 additions and 8 deletions.
  1. +20 −4 project.clj
  2. +4 −0 run-tests.sh
  3. +10 −4 src/conjure/core.clj
View
24 project.clj
@@ -1,5 +1,21 @@
-(defproject org.clojars.runa/conjure "1.0.0"
- :description "conjure mocking and stubbing"
- :dependencies [[org.clojure/clojure "1.3.0"]]
+(def common-deps '[])
+
+(defproject org.clojars.runa/conjure "1.0.1"
+ :description "Conjure mocking and stubbing"
+ :dependencies ~(cons '[org.clojure/clojure "1.3.0"]
+ common-deps)
+ :dev-dependencies [[jonase/kibit "0.0.3"]
+ [jonase/eastwood "0.0.2"]
+ [lein-multi "1.1.0"]]
:plugins [[lein-swank "1.4.4"]
- [lein-difftest "1.3.8"]])
+ [lein-difftest "1.3.8"]]
+ :multi-deps {"1.2.0" [[org.clojure/clojure "1.2.0"]]
+ "1.2.1" [[org.clojure/clojure "1.2.1"]]
+ "1.3.0" [[org.clojure/clojure "1.3.0"]]
+ "1.4.0" [[org.clojure/clojure "1.4.0"]]
+ "1.5.0" [[org.clojure/clojure "1.5.0-alpha3"]]
+ :all ~common-deps})
+
+
+(def common-deps '[[org.clojure/tools.logging "0.2.3"]])
+
View
4 run-tests.sh
@@ -0,0 +1,4 @@
+lein multi test --with "1.2.0" ;
+lein multi test --with "1.3.0" ;
+lein multi test --with "1.4.0" ;
+lein multi test --with "1.5.0"
View
14 src/conjure/core.clj
@@ -41,15 +41,21 @@
(reset! call-times {}))
(defmacro mocking [fn-names & body]
- (let [mocks (for [name fn-names]
+ (let [binding-or-stubbing (if (= 2 (:minor *clojure-version*))
+ 'binding
+ 'with-redefs)
+ mocks (for [name fn-names]
`(conjure.core/mock-fn ~name))]
- `(with-redefs [~@(interleave fn-names mocks)]
+ `(~binding-or-stubbing [~@(interleave fn-names mocks)]
~@body)))
(defmacro stubbing [stub-forms & body]
- (let [stub-pairs (partition 2 stub-forms)
+ (let [binding-or-stubbing (if (= 2 (:minor *clojure-version*))
+ 'binding
+ 'with-redefs)
+ stub-pairs (partition 2 stub-forms)
fn-names (map first stub-pairs)
stubs (for [[fn-name return-value] stub-pairs]
`(conjure.core/stub-fn ~fn-name ~return-value))]
- `(with-redefs [~@(interleave fn-names stubs)]
+ `(~binding-or-stubbing [~@(interleave fn-names stubs)]
~@body)))
Please sign in to comment.
Something went wrong with that request. Please try again.