Well, of course this is a classic situation in OO, if you think about it.
Googling around may shed some interesting light on the subject. Essentially,
the question is: are you sure that's what you want to do? Why not
concentrate your unit tests on the public interface in such a way that the
private methods get exercised too. Then, when (not if) your implementation
changes, your tests shouldn't have to.

On Tue, Jun 2, 2009 at 11:57 PM, Allen Rohner <aroh...@gmail.com> wrote:

>
> 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