4 new Test::* modules

nik on 2005-07-09T10:59:40

I've been busy over the past week producing four new Test::* modules.

These are a bit different from most other Test::* modules, which are normally written to help you test your code. These, however, are designed to help you test the environment that your code is going to be running in.

Test::Symlink lets you easily verify that a symlink exists, and that it links to the correct location.
    symlink_ok($src => $dst);

Test::Unix::Group and Test:::Unix::User let you verify that a user, group, and home directory exist.

    user_ok({ name => 'nik', uid => 1000}, 'nik has uid 1000');
    
    homedir_ok({ name => 'nik', group => 'staff' },
        "nik's homedir is owned by the staff group");
	
    group_ok({ name => 'wheel', members => [qw(root nik)]},
        "'wheel' has the correct members");

Finally, there's Test::Net::Connect, which lets you make sure that you can make a network connection to a particular host.

    connect_ok({ host => 'www.example.com', port => 80 },
        "Web server is reachable from here");


Hmmmmm

jk2addict on 2005-07-09T16:51:04

It appears that the CPAN Ratings is having issues, so here goes....

Wouldn't it have been slightly better to have made Test::User with Test::User::Unix, Test::User::Win32, etc child classes...sorta like File::Spec?

As it stands now, we would have to make a Test::Win32::User, which would turned out slightly dirty namespace wise for all of the possibilities...

Just a thought...

Module naming is always a bit subjective

nik on 2005-07-11T10:23:28

Wouldn't it have been slightly better to have made Test::User with Test::User::Unix, Test::User::Win32, etc child classes...sorta like File::Spec?

Six of one, half a dozen of the other I guess. Working out which order to put the 2nd and 3rd level namespaces in Perl modules is always a bit subjective. FWIW, I did get feedback from the perl-qa mailing list which suggested that Test::Unix::User/Group was appropriate.