[phobos] Split std.datetime in two?

Jonathan M Davis jmdavisProg at gmx.com
Fri Feb 11 02:32:04 PST 2011


On Friday 11 February 2011 02:24:08 spir wrote:
> On 02/11/2011 10:18 AM, Jonathan M Davis wrote:
> > However, I do acknoweldge that most people here disagree with me and
> > think that the length of the unit tests in std.datetime is excessive and
> > problematic. So, I will take time sometime relatively soon and work on
> > making them take less space. And any future anything that I propose to
> > Phobos, I will work on minimizing the amount of space that its unit
> > tests take up before I propose it.
> 
> Why not just do this as a final refactoring of each unitest, once all runs
> fine? (At least, if your tests are commonly suites of the same pattern
> with various input (mine are rarely like that, rather simulating client
> process using tested functinality), then use case arrays, I guess.)

Well, that's essentially what I'll be doing in the case of std.datetime, since 
it's already been written, tested, and debugged with the tests as they are. It's 
probably what I'll do with future code as well.

I really do think that unit tests should strive to be dead simple so that 
there's a lower risk of the tests being wrong. Once the functionality is 
complete, and you're reasonably certain that it's correct, then when you alter 
the tests to be less verbose, you at least have the confidence that when the 
tests fail, it's the tests that are wrong rather than the code. If the code is 
new however, that's a lot less clear. And the more complicated the tests, the 
more likely that they're wrong and the more likely that you'll miss bugs.

- Jonathan m Davis


More information about the phobos mailing list