From: Ryan Davis Date: 2006-09-22T11:43:18+09:00 Subject: Re: testunit message override? On Sep 21, 2006, at 6:55 PM, Ron Jeffries wrote: > On Thu, 21 Sep 2006 11:20:36 +0900, Logan Capaldo > > wrote: > >>> With the dates in a rather odd format, as you see above. Yet >>> Date's to_s method >>> is perfectly reasonable. >>> >> It's not calling Date#to_s, it's calling Date#inspect. I think you >> can >> do: >> assert_equal( a = Date.new(2006, 4, 15), b = calc.disbursal_date, >> "Expected Date of #{a}, got date of #{b}") > > Ah. #inspect. I did know the trick of the message parm, but it > still prints the > inspect anyway. I would have liked to be rid of it, or to have the > code call > to_s. I suppose I could override inspect if I really care. The message will use to_s, but without it, assert_equal and friends will use inspect. I don't like Date's inspect either so I'll often assert_equal against the #to_i results instead. That way it is obvious if I'm off by +/- 1 or my code is just plain wack. (oh, and hi Ron... long time!)