This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove superfluous variable $gr_mem.
[perl5.git] / lib / User / grent.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 use Test::More;
9
10 BEGIN {
11     our $hasgr;
12     eval { my @n = getgrgid 0 };
13     $hasgr = 1 unless $@ && $@ =~ /unimplemented/;
14     unless ($hasgr) { plan skip_all => "no getgrgid"; }
15     use Config;
16     $hasgr = 0 unless $Config{'i_grp'} eq 'define';
17     unless ($hasgr) { plan skip_all => "no grp.h"; }
18 }
19
20 BEGIN {
21     our $gid = $^O ne 'cygwin' ? 0 : 18;
22     our @grent = getgrgid $gid; # This is the function getgrgid.
23     unless (@grent) { plan skip_all => "no gid 0"; }
24 }
25
26 BEGIN {
27     plan tests => 5;
28     use_ok('User::grent');
29 }
30
31 can_ok(__PACKAGE__, 'getgrgid');
32
33 my $grent = getgrgid $gid;
34
35 is( $grent->name, $grent[0],    'name matches core getgrgid' );
36
37 is( $grent->passwd, $grent[1],  '   passwd' );
38
39 is( $grent->gid, $grent[2],     '   gid' );
40
41
42 # Testing pretty much anything else is unportable.
43