to follow-up on my question above, i was able to get this to work for me:
(defmacro before-each
[let-bindings & testing-blocks]
(assert (every? #(= 'testing (first %)) testing-blocks))
(let [bundles (for [block testing-blocks] `(let [~@let-bindings] ~block))]
`(do ~@bundles)))
the assert
isn't needed if you don't want to wrap every "block" in a testing
usage looks like this:
(deftest add-subtype-test
(before-each [sg {:subtypes []}]
(testing "accepts strings and keywords"
(is (add-subtype sg "type"))
(is (add-subtype sg :type)))
(testing "performs no change on keyword input"
(is (= "type" (first (:subtypes (add-subtype sg :type))))))
(testing "throws if given subtype isn't a keyword or string"
(is (thrown? java.lang.AssertionError (add-subtype sg nil))))))