Structuring unit tests
Thomas Lindgren
thomasl_erlang@REDACTED
Fri Apr 15 15:21:22 CEST 2005
--- Kostis Sagonas <kostis@REDACTED> wrote:
>
> Thomas Lindgren gave the following advice:
> >
> > --- Joel Reymont <joelr1@REDACTED> wrote:
> > > exporting all the tested functions or placing a
> > > -compile([export_all]) at the top of the module
> to be tested.
> >
> > You can also do that with a command line option:
> >
> > % erlc +export_all mymod.erl
> >
> > That means you can make it a flag in the
> makefile,
> > which often is useful.
>
> Please do not follow these paths, and please do not
> give such "advice".
--- Kostis Sagonas <kostis@REDACTED> wrote:
>
> Thomas Lindgren gave the following advice:
> >
> > --- Joel Reymont <joelr1@REDACTED> wrote:
> > > exporting all the tested functions or placing a
> > > -compile([export_all]) at the top of the module
> to be tested.
> >
> > You can also do that with a command line option:
> >
> > % erlc +export_all mymod.erl
> >
> > That means you can make it a flag in the
> makefile,
> > which often is useful.
>
> Please do not follow these paths, and please do not
> give such "advice".
On the contrary, I have found doing this very
convenient, not only for separating tests from the
rest of the code (which I tend to prefer) but also for
interactive testing and debugging. You can then get
rid of export_all lodged in the modules, and can, if
you so desire, subsequently eliminate its use entirely
by a makefile option.
So I have no qualms with such advice (no scare quotes
needed). I've used it for a couple of years, it has
worked well enough, I like it. In the end, it's up to
the reader to evaluate and decide, of course.
Best,
Thomas
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
More information about the erlang-questions
mailing list