On 25/06/12 12:31, Tassilo Horn wrote:
"Jim - FooBar();" <[email protected]> writes:
Hi Jim,
the only thing I can think of in order to test whether a fn does
indeed throw an exception when certain circumstances are met is
something like this:
(fact (try (fn-that-throws-exc bad-arg)
(catch Exception e :works)) => :works)
I thought I can also return the actual Exception object (e) but on second
thought I don't see any advantages...
Any ideas?
I don't know what you are using for testing (what's `fact`?), but with
clojure.test you can check for thrown exceptions. Search for thrown?
and thrown-with-msg? at
http://clojure.github.com/clojure/clojure.test-api.html
Bye,
Tassilo
I'm using midje... thanks both of you I'll check the links
Jim
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en