I am normally loathe to write tests, but for Mac::Carbon, I am making an exception. So the other night, I started working on a test suite. It is far from exhaustive, but it is a nice beginning. It does things like get a list of your volumes, convert them from FSSpec to paths, make sure the paths exist with -d, runs an AppleScript to get the version of the Finder, gets/sets creator/type of files, displays the amount of RAM in and the clock speed of the machine, displays a notification dialog to tell you to switch various applications to the front/back, plays a sound from a resource file, talks using the speech manager, and more.
I am even using Test::More, which makes life easier. I may need to include it in MacPerl. It's all working really well thus far.
I just need to add some more tests for Mac::Files and Mac::MoreFiles, then clean it up (which includes making it build on machines other than this one and integrating the changes with MacPerl). Then: profit! I mean: release!
Now Playing: Fired - Ben Folds (Rockin' the Suburbs)
-Dom
--Nat
Re:Yes but ...
pudge on 2002-11-07T17:03:43
Not that I can recall, but much of the test suite would have failed if not for detection of problems in my previous one-off tests (I wrote a lot of one-liners while working on the port).
These modules have all been around so long (most of them for upwards of 6 years) that the bugs in them are few and far between. I am changing very little of the modules; most of the bugs will have to do with my ported support functions (for time conversions, GUSI replacement functions, etc.) and various unique interactions with Mac OS X.
And at least one bug remains in the tests, though I can't really detect it with Perl (the Notification Manager simply doesn't play a sound I pass to it, and the only record of this is the fact that nothing comes out of the speakers...).
The test suite is just a beginning; it'd be nice to test every function in every conceivable way, but hopefully that is something other interested parties can help with.:D
The most difficult modules to write tests for are Mac::Files and Mac::MoreFiles, and I imagine most bugs, if they exist, are to be found there. And those are the ones I've not yet written tests for.