Created
July 17, 2019 17:22
-
-
Save nikolavojicic/01e05fca39b13b3c228478695cdda5e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://nakkaya.com/2009/11/18/unit-testing-in-clojure/ | |
(defmacro with-private-fns [[ns fns] & tests] | |
"Refers private fns from ns and runs tests in context." | |
`(let ~(reduce #(conj %1 %2 `(ns-resolve '~ns '~%2)) [] fns) | |
~@tests)) | |
(with-private-fns [org.foo.bar [fn1 fn2]] | |
(deftest test-fn1..) | |
(deftest test-fn2..)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment