Sorry for the necro, but I just started using error-kit and read this thread for the first time today.
Both error-kit (errors no longer inherit from *error* AFAICT) and test- is (the report function syntax) have changed since David last posted a working function, so I've updated it work with the latest revision of contrib. Would it make sense for this to be included in error_kit.clj? That way raised? would automatically work when testing any error-kit'ed code. Attached is a patch for adding raised? to error-kit. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
error_kit_test_is.patch
Description: Binary data
On Feb 16, 2009, at 12:13 PM, David Nolen wrote: > (defmethod assert-expr 'raised? [msg [_ error-type & body :as form]] > (let [error-name (qualify-sym error-type)] > `(with-handler > (do > ~...@body > (report :fail ~msg '~form ~(str error-name " not raised."))) > (handle ~error-type {:as err#} > (report :pass ~msg '~form nil)) > (handle *error* {:as err#} > (report :fail ~msg '~form (:tag err#)))))) > > You're right I think the entire first handle statement was wrong. I > believe handle does the isa? check on the error type, correct? If so > then this will allow inherited error types to pass the test. > > Many, many thanks for the feedback. > > test-is + error-kit is a great combo. > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -~----------~----~----~----~------~----~------~--~--- >