Closed maxbrunsfeld closed 10 years ago
You're welcome. I'm open to the option. What assertion libraries are out there? Do they all use AssertionError as the base exception?
Micah
On Apr 19, 2013, at 12:13 AM, maxbrunsfeld notifications@github.com wrote:
Thanks for building this! What are your thoughts on making should= et al throw the standard exception type AssertionError, rather than your own? It seems like that would facilitate writing interchangeable assertion libraries that work with speclj.
— Reply to this email directly or view it on GitHub.
Well right now as far as I know there's just clojure.core/assert
, which throws an AssertionError
.
I'd like to be able to add matchers to my speclj test suite as easily as possible (and possibly make them available as a specialized matcher library). I could of course just (:import specljs.SpecFailure)
, but I feel it'd be nicer to just use what's in clojure.core
.
Also, someone might want to write a library that supports another syntax for making assertions, and it'd be great if they could be dropped into a speclj test suite. In that case too, using AssertionError
would make it easier.
Included in 2.6.0
We may need to revisit this. I didn't see any problem at the time, but now there doesn't appear to be any way to exercise code like this without failing a spec.
(defn get-valid-input [input]
(assert (valid? input))
input)
The assert's behavior can't be verified with a should-throw
test since should-throw
now re-throws any AssertionError. I'm not seeing a clear way to fix it, unfortunately.
SpecFailure has been restored.
2.8.1 contains the restoration of SpecFailure.
Thanks for building this! What are your thoughts on making
should=
et al. throw the standard exception typeAssertionError
, rather than your own? It seems like that would facilitate writing interchangeable assertion libraries that work with speclj.