Hello,
I have a question regarding what is typically expected of unit tests in the Clojure codebase, with specific regard to test/is function calls and failures.
Clearly, when making changes or additions to a codebase, it's a good thing to make new code mesh with the style and idioms of the existing code, and I've tried to do this; however, having examined the Clojure codebase, I have found it hard to discern if failing tests should cause build failure (or not).
For example:
In "test/clojure/test_clojure/reader.clj" many of the test assertions are wrapped in a (testing …) function which will cause the build to fail upon test failure.
The pattern in test/clojure/test_clojure/data_structures.clj is very different – long lists of test/is calls, but nothing is wrapped in (testing …) functions. Consequently, failing calls to test/is simply outputs an error (no proper failures), the Clojure build completes and it spits out a jar.
Personally, I don't think it should be possible to build a package when tests are failing, but there may be reasons for taking the opposite approach. Please comment on the desired approach, so that the next time I write a test, I can "do the right thing".
If there is a preferred testing standard, then perhaps it should be added to the Library Coding Standards section at http://dev.clojure.org/display/design/Library+Coding+Standards.
Thanks,
Scott
Scott Lowe writes: