Commit | Line | Data |
---|---|---|
6888c95f | 1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
6 | } | |
7 | ||
27e62af5 | 8 | use Test::More; |
7b717bbd | 9 | |
6888c95f | 10 | BEGIN { |
11 | our $hasgr; | |
12 | eval { my @n = getgrgid 0 }; | |
13 | $hasgr = 1 unless $@ && $@ =~ /unimplemented/; | |
7b717bbd | 14 | unless ($hasgr) { plan skip_all => "no getgrgid"; } |
6888c95f | 15 | use Config; |
16 | $hasgr = 0 unless $Config{'i_grp'} eq 'define'; | |
7b717bbd | 17 | unless ($hasgr) { plan skip_all => "no grp.h"; } |
6888c95f | 18 | } |
19 | ||
20 | BEGIN { | |
21 | our @grent = getgrgid 0; # This is the function getgrgid. | |
7b717bbd | 22 | unless (@grent) { plan skip_all => "no gid 0"; } |
6888c95f | 23 | } |
24 | ||
18234ead | 25 | BEGIN { |
26 | plan tests => 5; | |
27 | use_ok('User::grent'); | |
28 | } | |
6888c95f | 29 | |
7b717bbd | 30 | can_ok(__PACKAGE__, 'getgrgid'); |
6888c95f | 31 | |
7b717bbd | 32 | my $grent = getgrgid 0; |
6888c95f | 33 | |
7b717bbd | 34 | is( $grent->name, $grent[0], 'name matches core getgrgid' ); |
6888c95f | 35 | |
7b717bbd | 36 | is( $grent->passwd, $grent[1], ' passwd' ); |
6888c95f | 37 | |
7b717bbd | 38 | is( $grent->gid, $grent[2], ' gid' ); |
6888c95f | 39 | |
6888c95f | 40 | |
41 | # Testing pretty much anything else is unportable. | |
42 |