Skip to content

Instantly share code, notes, and snippets.

@nikolavojicic
Created July 17, 2019 17:22
Show Gist options
  • Save nikolavojicic/01e05fca39b13b3c228478695cdda5e6 to your computer and use it in GitHub Desktop.
Save nikolavojicic/01e05fca39b13b3c228478695cdda5e6 to your computer and use it in GitHub Desktop.
;; 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