Hi James,

thanks for your answer.

> your tests should be testing your public interface

Hhmmm.
Well, I tend to disagree here. I sometimes like to have tests in place
for things I want to refactor. To not inadvertently do something
foolish.

But I agree that this is not easily accomplishable.

Greetings, alux

On 10 Sep., 13:39, James Reeves <jree...@weavejester.com> wrote:
> On 10 September 2010 12:24, alux <alu...@googlemail.com> wrote:
>
> > I always thought it to be good style to make helper functions only as
> > visible as needed, e.g. by using letfn.
>
> > But when I want to test my code, I just dont see a way to access these
> > local functions for tests.
>
> I don't believe you can. You could make them private functions, and
> then test them by referring directly to their vars, e.g.
>
> (#'your.namespace/private-function ...)
>
> But in general, your tests should be testing your public interface,
> not a specific implementation. Your tests shouldn't care what your
> code does behind the scenes, so long as the publicly accessible
> functions return the correct result.
>
> - James

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