This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Test::Unit makes me write better C code
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Today, once again, Nathaniel Talbott's Test::Unit helped me eliminate some bad C code in a Ruby extension that I'm writing. You see, Test::Unit has a good habit of causing the interpreter to segfault/core-dump where seemingly straightforward sample programs work without incident.
Why is this good? Because 99% of the time it means you've got some bad C code somewhere. I've learned that this *usually* means that you've got a memory leak buried somewhere in your C code. Or you're using a pointer to some data structure incorrectly in some fashion. I don't mean the sorts of things that are going to get picked up by -Wall, either.
I can't remember why Test::Unit (inadvertently) finds these bugs. Nathaniel told me once and I've forgotten (again). But, whatever. It works and I'm thankful. :)