Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilatate writing clojure.core.test tests for slingshot exceptions #21

Closed
hugoduncan opened this issue Mar 3, 2012 · 3 comments
Closed

Comments

@hugoduncan
Copy link
Contributor

When writing tests, it is common to want to check that a function throws in a given situation. Since the slingshot exception class is not fixed across clojure versions, and c.c.t's thrown? takes an unevaluated exception type argument, this is not straightforward.

The code I am currently using for this is https://gist.github.com/1966770

@scgilardi
Copy link
Owner

I've added thrown+? and thrown+-with-msg? to clojure.test's multimethod for test support. For getting the thrown object, recent versions of slingshot include get-thrown-object. Please let me know what you think.

@hugoduncan
Copy link
Contributor Author

Looks much better than what I had :) I didn't realise clojure.test was open coded like that.

@scgilardi
Copy link
Owner

fixed in 0.10.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants