On Nov 5, 2006, at 11:08 AM, David Vallner wrote:
> By cluttering the file internally with code not related to its main
> purpose? I still claim laziness being the motive to not separate these
> things,

Ah, but is laziness not one of the cardinal virtues?


> Either way, YMMV. I'll concede that this is more of a religious than
> technical issue for me, stemming from my preference to separate  
> concerns
> as tidily as possible.

"Separating concerns" sounds like a good principle, but I'd describe  
keeping test code in the library source file as "keeping related  
things together", which is an equally good principle.  Now, in many  
cases it may be better, or even necessary, to keep tests separate  
from the code, but I think it makes a lot of sense to keep basic  
functionality tests in same source file as the module they're  
testing.  I also first encountered this style in the Python  
community, and have come to like it.  I especially like using this  
style when I first start writing a new module; later, when my modules  
become more mature and the tests get longer, I might migrate them out  
to separate files.  It makes me happy to learn that Ruby supports  
this as well.  (I don't think Perl does.)


TomP