[phobos] Split std.datetime in two?

Andrei Alexandrescu andrei at erdani.com
Fri Feb 11 14:20:05 PST 2011


On 2/11/11 4:13 PM, Steve Schveighoffer wrote:
>> From:Andrei Alexandrescu<andrei at erdani.com>
>> When the unittest fails I go and edit the code as such:
>>
>>      assert(foo(x), text("foo(", x, ") failed"));
>
> As long as the unit test looks like this to begin with, I have no problem.  It should be the responsibility of the unit test writer to make sure the error messages clearly indicate what inputs cause the error.

I never start with the detailed message. I add them opportunistically as 
unittests fail. Works /perfectly/.

> I also want to stress that this is a simple loop example, and not too difficult to understand.  I don't think complex factored code is a good idea to have.

Agreed, but I repeat: an overwhelming majority of std.datetime's 
unittests can be converted in simple loops, as I took the time to 
exemplify in another message.

> BTW, where is text defined?  It should be available everywhere.

std.conv.


Andrei


More information about the phobos mailing list