Skip to content

Instantly share code, notes, and snippets.

@timgluz
Created November 30, 2013 12:36
Show Gist options
  • Save timgluz/7718519 to your computer and use it in GitHub Desktop.
Save timgluz/7718519 to your computer and use it in GitHub Desktop.
Testing cljs.core.async channels.
1 (ns chord.client-test
2 (:require-macros [cemerick.cljs.test :refer [is deftest run-tests testing test-var]])
3 (:require [cemerick.cljs.test :as t]
4 [cljs.core.async :refer [unblocking-buffer? put!]]
5 [chord.client :as chord]))
6
7 (deftest make-channel-without-buffer
8 (let [ch (chord/make-channel)]
9 (is (= false (nil? ch)))
10 (is (= false (unblocking-buffer? ch)))
11 (dotimes [i 1024]
12 (put! ch i))
13 (is (= 1024 (count ch)))
14 (throws? (put! ch 1024))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment