Re: clojure.test parameterized tests

2014-05-06 Thread Sean Corfield
http://jayfields.com/expectations/in-context.html On May 6, 2014, at 12:14 PM, Brian Craft wrote: > Someone suggested the Expectations lib, but I don't see any fixture support > there. Anyone using Expectations that can point me to the right place? signature.asc Description: Message signed w

Re: clojure.test parameterized tests

2014-05-06 Thread Brian Craft
Using the "testing" macro introduces the same problem with fixtures. Fixtures don't run except around things defined with deftest. Anyone have an example of a test 1) parameterized, and 2) with working fixture? Someone suggested the Expectations lib, but I don't see any fixture support there.

Re: clojure.test parameterized tests

2014-05-04 Thread Reid Draper
Keep in mind too that since test.check/quick-check takes a property as an argument, you can construct a property by simply closing over some implementation. For example: (defn make-prop [impl] (prop/for-all [...] (= (impl ...) (other ...))) And then test with different properties create

Re: clojure.test parameterized tests

2014-05-02 Thread Brian Craft
Wow, I never would have figured that out from the docs. Thanks. Just found a different problem with my solution: nested tests, as described in the docs, prevent the use of fixtures. You have to add test-ns-hook when using nested tests, and then fixtures aren't run. On Friday, May 2, 2014 11:05:

Re: clojure.test parameterized tests

2014-05-02 Thread Karsten Schmidt
You can use the `testing` macro and wrap it in a function, which accepts your type/protocol implementation or even individual protocol methods as args. Example here: https://github.com/thi-ng/geom/blob/master/test/core.org#callable-contexts On 2 May 2014 18:08, "Brian Craft" wrote: > Thanks. I d

Re: clojure.test parameterized tests

2014-05-02 Thread Brian Craft
Thanks. I did something similar. I have different implementations per db, so use a global *db* var: (ct/deftest run-tests (matrix1)) ; matrix1 tests against *db* (ct/deftest test-h2 (binding [*db* (h2/create-db2 "test" {:subprotocol "h2:mem"})] (run-tests))) (defn test-ns-hook [] (tes

Re: clojure.test parameterized tests

2014-05-02 Thread Chris Price
I have been curious about this too. I was playing around with it a few weeks ago and came up with this: https://github.com/cprice404/clj-shared-test-sandbox/blob/master/test/shared_tests_foo/core_test.clj Which is pretty gross; it uses `binding` + a dynamic var in the shared test namespace, an