This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-14
Channels
- # admin-announcements (1)
- # beginners (18)
- # boot (61)
- # cljsjs (4)
- # cljsrn (12)
- # clojure (60)
- # clojure-gamedev (1)
- # clojure-russia (13)
- # clojure-taiwan (1)
- # clojure-uk (4)
- # clojurescript (62)
- # core-async (7)
- # cursive (1)
- # data-science (1)
- # hoplon (74)
- # lein-figwheel (3)
- # off-topic (3)
- # om (2)
- # other-languages (58)
- # planck (4)
- # protorepl (3)
- # reagent (58)
- # rethinkdb (1)
- # spacemacs (1)
Hi, I’m wondering how I could write tests for functions that use core.async. Say I have the following function:
(defn foo
[]
(go
(a/<! (a/timeout 1000))
42))
There is a similar question on Stack Overflow: http://stackoverflow.com/q/30766215
Is it possible to write a test, that
* fails if the channel returned by foo does not provide any value within 5 seconds,
* fails if the channel provides anything else than 42,
* fails if the channel does not close after providing 42,
* does not block other tests from running? (That’s the hard part!)