Skip to content
Browse files

Added unit test for test-conduit-fn

  • Loading branch information...
1 parent 9caf25c commit 3d2734632f303d4cb9ed70238ca19252877039c5 Jim Duey committed
Showing with 25 additions and 2 deletions.
  1. +1 −1 src/conduit/core.clj
  2. +24 −1 test/conduit/test/core.clj
View
2 src/conduit/core.clj
@@ -301,7 +301,7 @@
(defn test-conduit [p]
(let [args (:args (meta p))]
- (condp = (:created-by p)
+ (condp = (:created-by (meta p))
nil p
:a-arr (a-arr args)
:a-comp (apply a-comp (map test-conduit args))
View
25 test/conduit/test/core.clj
@@ -253,6 +253,29 @@
(conduit-map make-and-dec
(range 6))))))
-(deftest test-text-conduit-fn
+(deftest test-test-conduit-fn
(is (= 5 (first ((test-conduit-fn pl) 4)))))
+(deftest test-test
+ (let [test-proc (a-comp
+ (a-arr inc)
+ (with-meta
+ (fn [x]
+ (throw (Exception. "Should not be thrown")))
+ (select-keys (meta (a-arr (partial * 2)))
+ [:created-by :args])))
+ sel-test (a-comp
+ (a-all (a-arr even?)
+ pass-through)
+ (a-select true test-proc
+ false pass-through))
+ test-fn (test-conduit-fn test-proc)]
+
+ (is (= [8 10 12 14]
+ (mapcat test-fn (range 3 7))))
+ (is (= [8 10 12 14]
+ (conduit-map (test-conduit test-proc)
+ (range 3 7))))
+ (is (= [2 1 6 3 10 5 14]
+ (conduit-map (test-conduit sel-test)
+ (range 7))))))

0 comments on commit 3d27346

Please sign in to comment.
Something went wrong with that request. Please try again.