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
Post by J IrvingHey 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
Post by Timothy BaldridgeI 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
Post by mynomotoYou can use a macro. Look how on
http://nakkaya.com/2009/11/18/unit-testing-in-clojure/
Post by Hussein B.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.
Note that posts from new members are moderated - please be patient with
your first post.
To unsubscribe from this group, send email to
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
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.
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
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
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Clojure" group.
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
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
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 ***@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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.