Advertisement
Guest User

with-private-fns

a guest
Mar 24th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. (defmacro with-private-fns [[ns fns] & tests]
  2. "Refers private fns from ns and runs tests in context."
  3. `(let ~(reduce
  4. #(conj %1 %2 `(ns-resolve '~ns '~%2))
  5. []
  6. fns
  7. )
  8. ~@tests
  9. )
  10. )
  11.  
  12.  
  13. (comment
  14.  
  15. ; This macro is used as:
  16.  
  17. (with-private-fns [org.foo.bar [fn1 fn2]]
  18. (deftest test-fn1..)
  19. (deftest test-fn2..)
  20. )
  21.  
  22. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement