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