Why think unit tests should be in their own source code hierarchy instead of side-by-side

Jacob Carlborg doob at me.com
Sat Mar 24 16:28:00 UTC 2018


On 2018-03-23 21:43, H. S. Teoh wrote:

> Yep.  As I mentioned elsewhere, recently I've had to resort to external
> testing for one of my projects, and I'm still working on that right now.
> And already, I'm seeing a liability: rather than quickly locating a
> unittest immediately following a particular function, now I have to
> remember "oh which subdirectory was it that the tests were put in? and
> which file was it that a particular test of this function was done?".

Put the tests in a directory called "tests" and follow the same file and 
directory structure as the regular code.

It's just a matter of configuring a command in an editor that will find 
the corresponding test file and navigate to it. Or dump your editor if 
it doesn't support custom commands 'cos it sux and you deserve better. 
:-D  I mean, this is 2018, not 1995, we shouldn't have to be stuck with 
the handicap of clicking through files and directories to find the right 
test file anymore.

:D

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list