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.
ok(my $h = Handle->new('xyzzy'), 'new handle');
is($h->get, 'xyzzy', 'get handle');
is($h->size, 5, 'handle size');
is($h->get(2, 2), 'zz', 'get handle portion');
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)