Welcome! Please see the About page for a little more info on how this works.
(is (not (<! ...))) works, but (is (<! ...)) doesn't.
(is (not (<! ...)))
(is (<! ...))
Under the hood, is rewrites the code in such a way that it calls (apply <!
...), because is assumes that <! is a plain function (see: assert-expr
:default(link: 1), assert-predicate(link: 2) in clojure.test). It triggers the ">! used
not in (go ...) block" assertion.
(link: 1) -- https://github.com/clojure/clojure/blob/2e0c0a9a89ede8221504edeb90e8c4ee6cce7e16/src/clj/clojure/test.clj#L486
(link: 2) -- https://github.com/clojure/clojure/blob/2e0c0a9a89ede8221504edeb90e8c4ee6cce7e16/src/clj/clojure/test.clj#L435
Example code: https://gist.github.com/augustl/4a679dc95847db4434d0e7348651224f#file-test-cljs-L34
Workaround: make assert-expr aware of special core.async functions, and use
assert-any for those. It's reasonable since core.async is a widely-used core
library. It'd fix the particular problem described in this issue.
The correct solution would be to make <! and >! macros instead of functions.
Comment made by: alexmiller
is has multimethod support for custom expressions, so I think this could be patched by adding assert-expr methods on <! and >! (probably in a core.async namespace that provides test support).