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.
is
(apply <! ...)
assert-expr :default
assert-predicate
(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 Macroexpansion: https://gist.github.com/amalloy/26ec8b8910c7c00bd7feaeef2307bc92#file-gistfile1-txt-L48
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.
assert-expr
assert-any
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).