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.
http://jayfields.com/expectations/in-context.html
On May 6, 2014, at 12:14 PM, Brian Craft craft.br...@gmail.com 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
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
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,
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 []
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 craft.br...@gmail.com
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
I have a number of tests that I would like to run against different
implementations of a protocol. In clojure.test there doesn't appear to be a
way to parameterize a test over the implementations. Is there a good way to
do this?
--
You received this message because you are subscribed to the