Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Fix atom sink typo causing ClassCastException #77

Merged
merged 1 commit into from Oct 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lamina/core/watch.clj
Expand Up @@ -25,7 +25,7 @@
"Transforms a `channel` into an atom which updated with the value of each new message."
([channel]
(atom-sink nil channel))
([initial-value ch]
([initial-value channel]
(let [a (atom initial-value)]
(receive-all channel #(reset! a %))
a)))
20 changes: 20 additions & 0 deletions test/lamina/test/watch.clj
@@ -0,0 +1,20 @@
;; Copyright (c) Aaron VonderHaar. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.

(ns lamina.test.watch
(:use
[clojure test]
[lamina.core channel]
[lamina.core.watch]))

;;;

(deftest test-atom-sink
(let [ch (channel 0 1 2)
!a (atom-sink ch)]
(is (= @!a 2))))