Re: Exception testing with clojure.test

2011-07-19 Thread Jonathan Cardoso
Thank's a lot. That's exactly what I was looking for and didn't realize there was a thrown? function in the API =S Thanks. -- 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 Note that posts

Re: Exception testing with clojure.test

2011-07-19 Thread Brian Marick
On Jul 19, 2011, at 3:48 PM, Jonathan Cardoso wrote: > Hi guys, > > I want to test some code that throws exceptions, but I don't want exceptions > to be thrown in the console. jcrit.server=> (use 'midje.sweet) jcrit.server=> (fact (f) => (throws NullPointerException

Re: Exception testing with clojure.test

2011-07-19 Thread Sam Ritchie
Yup, this should do the trick: (defn only-odds [x] {:pre [(odd? x)]} x) (deftest only-odds-test (is (thrown? AssertionError (only-odds 2))) (is (= 1 (only-odds 1 On Tue, Jul 19, 2011 at 4:48 PM, Jonathan Cardoso wrote: > Hi guys, > > I want to test some code that throws except

Exception testing with clojure.test

2011-07-19 Thread Jonathan Cardoso
Hi guys, I want to test some code that throws exceptions, but I don't want exceptions to be thrown in the console. Is there a way to do that with *is* function? What is the best way to test my code with try-catch blocks? -- You received this message because you are subscribed to the Google Gr