# Specification: clojure.core.async on Janet fibers (Phase 1 — API layer). # Each case is self-contained: it requires the ns, sets up channels/go blocks, # and ends with a take that pumps the event loop and yields the value compared. (use ../support/harness) (def REQ "(require '[clojure.core.async :refer [go go-loop chan ! close! alts! timeout put! take! chan?]]) ") (defn- a [body] (string "(do " REQ body ")")) (defspec "core.async / go & channels" ["go produce, ! c (+ 40 2))) ( channel closes" "nil" (a "(! x 10)) (go (>! y 32)) (! c 1) (>! c 2) (>! c 3) (close! c)) (! c :a) (close! c)) (! to a closed channel is false" "false" (a "(def c (chan 1)) (close! c) (>! c 1)")] ["take from closed empty channel is nil" "nil" (a "(def c (chan)) (close! c) (! in 1) (>! in 2) (>! in 3) (close! in)) (! mid (inc (! out (* 10 (! in 4)) (! y :v)) (! c 7)) (