Browse files

added failed-agent test for pprint

Signed-off-by: Stuart Halloway <>
  • Loading branch information...
1 parent d1e39b1 commit 65ae4928119a50e892bc33e8cbb47a82ebef98ee @stuarthalloway stuarthalloway committed May 19, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 test/clojure/test_clojure/pprint/test_pretty.clj
@@ -209,21 +209,28 @@ Usage: *hello*
(deliver promise-filled '(first second third))
(def promise-unfilled (promise))
(def basic-agent (agent '(first second third)))
+(defn failed-agent
+ "must be a fn because you cannot await agents during load"
+ []
+ (let [a (agent "foo")]
+ (send a +)
+ (try (await-for 100 failed-agent) (catch RuntimeException re))
+ a))
(def basic-atom (atom '(first second third)))
(def basic-ref (ref '(first second third)))
(def delay-forced (delay '(first second third)))
(force delay-forced)
(def delay-unforced (delay '(first second third)))
(defrecord pprint-test-rec [a b c])
(simple-tests pprint-datastructures-tests
(tst-pprint 20 future-filled) #"#<Future@[0-9a-f]+: \n 100>"
(tst-pprint 20 future-unfilled) #"#<Future@[0-9a-f]+: \n :pending>"
(tst-pprint 20 promise-filled) #"#<Promise@[0-9a-f]+: \n \(first\n second\n third\)>"
;; This hangs currently, cause we can't figure out whether a promise is filled
;;(tst-pprint 20 promise-unfilled) #"#<Promise@[0-9a-f]+: \n :pending>"
(tst-pprint 20 basic-agent) #"#<Agent@[0-9a-f]+: \n \(first\n second\n third\)>"
+ (tst-pprint 20 (failed-agent)) #"#<Agent@[0-9a-f]+ FAILED: \n \"foo\">"
(tst-pprint 20 basic-atom) #"#<Atom@[0-9a-f]+: \n \(first\n second\n third\)>"
(tst-pprint 20 basic-ref) #"#<Ref@[0-9a-f]+: \n \(first\n second\n third\)>"
(tst-pprint 20 delay-forced) #"#<Delay@[0-9a-f]+: \n \(first\n second\n third\)>"

0 comments on commit 65ae492

Please sign in to comment.