Last active
August 29, 2015 14:27
-
-
Save yanatan16/9bb640e92be2b1fa4c7c to your computer and use it in GitHub Desktop.
tap doesnt work for the second channel if already closed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.core.async :refer (<!! >!! close! chan mult tap alt!! timeout)]) | |
(defn assert-closed! [c m] (assert (= nil (alt!! c ([v] v) (timeout 50) ([_] :timeout))) m)) | |
(let [[c1 c2 c3] (repeatedly 3 chan) | |
_ (close! c1) | |
m (mult c1)] | |
(tap m c2) | |
(<!! (timeout 50)) | |
(tap m c3) | |
(<!! (timeout 50)) | |
(assert-closed! c1 "c1 sanity") | |
(assert-closed! c1 "c2 should") | |
(assert-closed! c3 "c3 test") ; So this assert fails because tap doesn't check to see if mult-source is already closed. | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment