There are 6 defn-'s in there? Rich must have wrote that code :-P .

But yes, defn- is mostly used in clojure.core and other such libraries for
functions that are created to simplify other functions. And I would
probably never test those.

Even then I would caution about using defn- too much as some have pointed
out functions like clojure.core/assert-args is kindof handy, but it's
private, so you can't touch it.

Also, core.async tends to take a "in the large" view of testing. For
example, the guts of the go macro are never tested. Instead the macro is
tested in about 50 different ways. The idea being that if a single one of
those tests fail it's easy to figure out what's wrong based on what passes
and fails.

Timothy


On Thu, Jun 12, 2014 at 8:44 AM, J Irving <j...@lollyshouse.ca> wrote:

> Hey Timothy
>
> So I honestly don't mean to be a smart ass, but there are 6 defn-
> functions in clojure.core.async - how do you test those? Or are they just
> considered internals to other public functions?
>
> cheers, J
>
>
> On Thu, Jun 12, 2014 at 10:33 AM, Timothy Baldridge <tbaldri...@gmail.com>
> wrote:
>
>> I say this too many times on this list, but I'll say it again. The best
>> way to test defn- functions is to never use defn- in the first place.
>> Instead move implementation functions into an internal namespace that way
>> they can be accessed if needed, but are out of the way of the public api.
>> It also makes it easier for your users to tap into the core of your
>> library/application if needed. Trust your users to make good decisions,
>> make everything public, separate via namespaces.
>>
>> For an example of this see: http://github.com/clojure/core.async
>>
>> Timothy
>>
>>
>> On Thu, Jun 12, 2014 at 7:53 AM, mynomoto <mynom...@gmail.com> wrote:
>>
>>> You can use a macro. Look how on
>>> http://nakkaya.com/2009/11/18/unit-testing-in-clojure/
>>>
>>>
>>> On Thursday, June 12, 2014 5:44:21 AM UTC-3, Hussein B. wrote:
>>>>
>>>> Hi,
>>>>
>>>> I like to use (defn-) when it comes to internal implementation
>>>> functions. But since they aren't exposed, how to unit test them?
>>>>
>>>> Of course, I'm using Lein and clojure.test
>>>>
>>>> Thanks.
>>>>
>>>  --
>>> 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
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> “One of the main causes of the fall of the Roman Empire was that–lacking
>> zero–they had no way to indicate successful termination of their C
>> programs.”
>> (Robert Firth)
>>
>> --
>> 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
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to