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
<jonathancar...@gmail.com>wrote:

> 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
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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

-- 
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 from new members are moderated - please be patient with your 
first post.
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

Reply via email to