I've been attempting to combine error-kit and test-is, but getting the
relation between assert-expr form in test-is and the handle form in
error-kit is a bit tricky. Looking at the test-is thrown? example and
Chouser's error-kit post on the mailing list I tried something like the
following:
(defmethod assert-expr 'raised? [msg form]
(let [error-type (second form)
body (rrest form)]
`(with-handler
(do
~...@body
(report :fail ~msg '~form nil))
(handle {:keys [& rest#]}
(let [tag# (last rest#)]
(println "raised!" rest# ~error-type)
(if (= ~error-type tag#)
(report :pass ~msg '~form nil)
(report :fail ~msg '~form nil)))))))
The assert-expr seems OK, but I can't seem to get the error-type tag from
handle.
So here's the promised feedback on handle Chouser ;)
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---