Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add var *testing-conduit* used to indicate if a conduit is running as…

… a test-conduit. 0.8.π
  • Loading branch information...
commit e3faf87098793b3e1c31dd775676cbf38afc2f8e 1 parent 2718e80
@danlarkin danlarkin authored
Showing with 24 additions and 21 deletions.
  1. +1 −1  project.clj
  2. +23 −20 src/conduit/core.clj
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject conduit "0.8.1"
+(defproject conduit "0.8.π"
:description "Conduit: Stream Processing in Clojure."
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/clojure-contrib "1.2.0"]
View
43 src/conduit/core.clj
@@ -3,6 +3,8 @@
[clojure.pprint :only [pprint]]
arrows.core))
+(def *testing-conduit* false)
+
(defn merge-parts [ps]
(apply merge-with merge
(map :parts ps)))
@@ -431,26 +433,27 @@
(partial reply-fn xs))}))
(defn test-conduit [p]
- (condp = (:created-by p)
- nil p
- :conduit-proc (conduit-proc (:args p))
- :a-arr (a-arr (:args p))
- :a-comp (apply a-comp (map test-conduit (:args p)))
- :a-par (apply a-par (map test-conduit (:args p)))
- :a-all (apply a-all (map test-conduit (:args p)))
- :a-select (apply a-select (mapcat (fn [[k v]]
- [k (test-conduit v)])
- (:args p)))
- :a-loop (let [[bp iv fb] (:args p)]
- (if fb
- (a-loop (test-conduit bp)
- iv
- (test-conduit fb))
- (a-loop (test-conduit bp)
- iv)))
- :a-except (apply a-except (map test-conduit (:args p)))
- :a-finally (apply a-finally (map test-conduit (:args p)))
- :disperse (disperse (test-conduit (:args p)))))
+ (binding [*testing-conduit* true]
+ (condp = (:created-by p)
+ nil p
+ :conduit-proc (conduit-proc (:args p))
+ :a-arr (a-arr (:args p))
+ :a-comp (apply a-comp (map test-conduit (:args p)))
+ :a-par (apply a-par (map test-conduit (:args p)))
+ :a-all (apply a-all (map test-conduit (:args p)))
+ :a-select (apply a-select (mapcat (fn [[k v]]
+ [k (test-conduit v)])
+ (:args p)))
+ :a-loop (let [[bp iv fb] (:args p)]
+ (if fb
+ (a-loop (test-conduit bp)
+ iv
+ (test-conduit fb))
+ (a-loop (test-conduit bp)
+ iv)))
+ :a-except (apply a-except (map test-conduit (:args p)))
+ :a-finally (apply a-finally (map test-conduit (:args p)))
+ :disperse (disperse (test-conduit (:args p))))))
(defn test-conduit-fn [p]
(comp first (:reply (test-conduit p))))
Please sign in to comment.
Something went wrong with that request. Please try again.