bsd-jail-object/t/BSD-Jail-Object.t
branchperl-modules
changeset 0 315eb12b224b
equal deleted inserted replaced
-1:000000000000 0:315eb12b224b
       
     1 
       
     2 use Test::More;
       
     3 
       
     4 BEGIN
       
     5 {
       
     6     if ( $^O !~ /^freebsd$/i ) {
       
     7         plan skip_all => 'Module only usable under FreeBSD operating system';
       
     8     }
       
     9     else {
       
    10         if ( $< ) {
       
    11             plan skip_all => 'Must be root to run tests';
       
    12         }
       
    13         else {
       
    14             plan tests => 7;
       
    15             use_ok('BSD::Jail::Object');
       
    16         }
       
    17     }
       
    18 }
       
    19 
       
    20 # jail identifier we'll do our tests on
       
    21 my $jid;
       
    22 
       
    23 # all methods, public and private
       
    24 can_ok( 'BSD::Jail::Object', qw/
       
    25     new _init 
       
    26     jid ip hostname path
       
    27     attach jids
       
    28 
       
    29     sysctl_len _find_jail
       
    30     _find_jids _attach _create
       
    31 /);
       
    32 
       
    33 # create
       
    34 my $j = BSD::Jail::Object->new({
       
    35         path => '/tmp',
       
    36         hostname => 'bsd-jail-object-tester',
       
    37         ip => '127.0.0.1'
       
    38 });
       
    39 
       
    40 is( ref $j, 'BSD::Jail::Object', 'Object namespace' );
       
    41 is( $j->path, '/tmp', "path verify" );
       
    42 is( $j->ip, '127.0.0.1', "ip verify" );
       
    43 is( $j->hostname, 'bsd-jail-object-tester', "hostname verify" );
       
    44 like( $j->jid, qr/^\d+$/, 'jid is integer (' . $j->jid . ')' );
       
    45 
       
    46 # can't easily test attach()
       
    47         
       
    48 # end of tests
       
    49 
       
    50 
       
    51 
       
    52