On Jun 25, 2012, at 6:21 AM, Jim - FooBar(); wrote:
> (fact (try (fn-that-throws-exc bad-arg)
>         (catch Exception e :works)) => :works)

(fact
  (fn-that-throws-exc bad-arg) => (throws Exception))

You can also check the message, run a predicate over the exception, etc. 

https://github.com/marick/Midje/wiki/Checkers

> 
> Ah, ok.  Midje seems to support that, too.  See
> 
>  https://github.com/marick/Midje/wiki/Prerequisites-that-throw-exceptions

This is actually for sort of the opposite purpose. You're writing a function 
that needs to be able to handle an exception. That exception is hard to 
generate. So this is a way to artificially create and throw one.


-----
Brian Marick, Artisanal Labrador
Now working at http://path11.com
Contract programming in Ruby and Clojure
Occasional consulting on Agile


-- 
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