From: Eric Hodel Date: 2005-05-04T06:35:08+09:00 Subject: Re: Typo-checking instead of static typing On 03 May 2005, at 14:22, Hal Fulton wrote: > Eric Hodel wrote: >> On 03 May 2005, at 12:27, Ben Giddings wrote: >>> >>> My open question is then: how do you find typos and brainos in >>> seldom-run >>> code in a dynamic language like Ruby? >> Yes, unit tests and ruby -w. I wrote the thing in the 'I Rock.' post >> between midnight and 4am. As you can imagine, writing code tired is >> fraught with crazy typos, but the unit tests found them all. >> When I was almost done, I spent 15 minutes on a 1 character typo (rrc >> in one spot, rcc in another). I didn't have a unit test for that >> case. > > Let me put in a plug for code coverage tools in general. > Combined with good unit tests, these are truly invaluable. > > There's a good one out there, but I forget what it's called -- > I don't use it much, I've only played with it. ZenTest? PS: ZenTest comes, free of charge, with unit_diff, which is the spiffiest test running helper tool ever. It runs your actual/expected outputs through diff helping you spot the differences in massive structures. Or even small ones of one or two lines. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04