Hi Allen,

You could write a function that uses the clojure.contrib.with-ns/with- 
ns macro to dip into the namespace being tested and return the private  
function, assigning it to a local name in the test namespace.

I need this too, and have been meaning to ping the other Stuart about  
either (a) adding something like this to test-is, or (b) creating a  
new test-helpers library in contrib that would include this function.

Stu

>
> I have a namespace with some public functions, and some private
> functions. I would like to write unit tests for the functions, and put
> them in a separate file from the main name space. I would also like to
> have an (ns) declaration in my tests file, because the tests require
> several libraries. Of course, if I have private methods in namespace
> A, I can't call them from namespace B. Right now, it seems I have
> several options:
>
> 1) put the unit tests in the same file
> 2) put the unit tests in a separate file, in the same namespace
> 3) make the private functions public
> 4) ???
>
> I don't really like the first three options. Ideally, the private
> functions would remain private to every namespace except the testing
> name space. Is there a good solution for this?
>
> Allen
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to