summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2010-10-14 10:05:59 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-11-29 21:00:58 -0500
commitc69deb7444c82dda92171eb38b77227687b54359 (patch)
treee69342f63741609a90573f7f0a335afcbd5f888d
parent357b23111de3c9b0789097e716c81b89f013894a (diff)
test sending from an error handler #390
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--test/clojure/test_clojure/agents.clj8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/clojure/test_clojure/agents.clj b/test/clojure/test_clojure/agents.clj
index c0dcfd4f..b97655f8 100644
--- a/test/clojure/test_clojure/agents.clj
+++ b/test/clojure/test_clojure/agents.clj
@@ -55,6 +55,14 @@
(is (true? (instance? ArithmeticException (second @err))))
(is (thrown? RuntimeException (send agt inc)))))
+(deftest can-send-from-error-handler-before-popping-action-that-caused-error
+ (let [handler (fn [agt err]
+ (send *agent* (constantly :sent-after-error)))
+ failing-agent (agent nil :error-handler handler)]
+ (send failing-agent (fn [_] (throw (RuntimeException.))))
+ (await-for 1000 failing-agent)
+ (is (= :sent-after-error @failing-agent))))
+
(deftest restart-no-clear
(let [p (promise)
agt (agent 1 :error-mode :fail)]