www.digitalmars.com         C & C++   DMDScript  

D - Unit tests

reply Curtis d'Entremont <038535d acadiau.ca> writes:
Hi, I've been watching D for a bit now, and I do like what I see. I have a 
quick observation about unit tests..

I write unit tests for most of my code (using JUnit for java), and I find 
them very useful. The idea of making it part of the language is 
interesting, but I should warn you about putting it alongside the code 
you're testing. Personally, and I know some people might agree, I wouldn't 
want to have a whole bunch of unit tests sitting in my production code. The 
files would just be so long, cluttered, and hard to read through. It might 
also cause some annoyances with source control if you update your tests 
often, since they're in the same files as the actual code.

We should get more opinions on this, and perhaps try to reach a consensus on 
what the best solution is?

Curt
Nov 09 2002
parent "Walter" <walter digitalmars.com> writes:
I personally find that putting the unit tests right next to the code means I
am much more likely to make the unit tests up to date and comprehensive.

Of course, they can always just be moved to another file, or aggregated at
the end of the source file if their presence is distracting.

"Curtis d'Entremont" <038535d acadiau.ca> wrote in message
news:aqk8pa$2jpn$1 digitaldaemon.com...
 Hi, I've been watching D for a bit now, and I do like what I see. I have a
 quick observation about unit tests..

 I write unit tests for most of my code (using JUnit for java), and I find
 them very useful. The idea of making it part of the language is
 interesting, but I should warn you about putting it alongside the code
 you're testing. Personally, and I know some people might agree, I wouldn't
 want to have a whole bunch of unit tests sitting in my production code.
The
 files would just be so long, cluttered, and hard to read through. It might
 also cause some annoyances with source control if you update your tests
 often, since they're in the same files as the actual code.

 We should get more opinions on this, and perhaps try to reach a consensus
on
 what the best solution is?

 Curt
Nov 10 2002