Re: error-kit + test-is

2009-05-18 Thread joshua-choi
I'd love for that to happen—either error-kit support in test-is or test-is support in error-kit. clojure.contrib libraries should be able to use each other with no worries, since they'll be installed together just about always. On May 17, 12:52 am, Dan Larkin wrote: > Sorry for the necro, but I

Re: error-kit + test-is

2009-05-17 Thread Dan Larkin
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

Re: error-kit + test-is

2009-02-16 Thread Stuart Sierra
On Feb 16, 12:13 pm, David Nolen wrote: > test-is + error-kit is a great combo. Let me know if I can answer any questions about test-is, but you seem to have it well in hand. :) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: error-kit + test-is

2009-02-16 Thread Chouser
On Mon, Feb 16, 2009 at 12:13 PM, David Nolen wrote: > > I believe handle does the isa? check on the error type, correct? Right. > If so then this will allow inherited error types to pass the test. Sounds good! --Chouser --~--~-~--~~~---~--~~ You received this

Re: error-kit + test-is

2009-02-16 Thread David Nolen
(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 '~for

Re: error-kit + test-is

2009-02-16 Thread Chouser
On Mon, Feb 16, 2009 at 1:50 AM, David Nolen wrote: > >> I don't quite understand why you got through all that work to get >> error-str -- isn't it just (str (qualify-sym error-type))? >> >> ...and since you then use it only as an arg to 'symbol' or 'str', you >> could just use the symbol itself

Re: error-kit + test-is

2009-02-15 Thread David Nolen
> I don't quite understand why you got through all that work to get > error-str -- isn't it just (str (qualify-sym error-type))? > > ...and since you then use it only as an arg to 'symbol' or 'str', you > could just use the symbol itself instead of converting it to a string > and back. > If I brin

Re: error-kit + test-is

2009-02-15 Thread Chouser
On Mon, Feb 16, 2009 at 12:25 AM, David Nolen wrote: > (defmethod assert-expr 'raised? [msg form] > (let [error-type (second form) > error-meta (meta (find-var (qualify-sym error-type))) > error-str (str (ns-name (:ns error-meta)) "/" (:name error-meta)) > body (rrest form)]

Re: error-kit + test-is

2009-02-15 Thread David Nolen
Heh not macro, I meant multimethod. Here is the macro that seems to work, any improvements much appreciated ;) > This fails when no error is raised, when the wrong error type is raised, and > I believe it's captures errors which are derived but not the exact error (is > this a weird behavior?). Y

Re: error-kit + test-is

2009-02-15 Thread David Nolen
(defmethod assert-expr 'raised? [msg form] (let [error-type (second form) error-meta (meta (find-var (qualify-sym error-type))) error-str (str (ns-name (:ns error-meta)) "/" (:name error-meta)) body (rrest form)] `(with-handler (do ~...@body (report :fail ~msg

Re: error-kit + test-is

2009-02-15 Thread Chouser
On Sun, Feb 15, 2009 at 10:06 PM, David Nolen wrote: > 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