This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ID 20011206.007 File::Find:name set to empty string for "/"
[perl5.git] / lib / User / grent.t
CommitLineData
6888c95f
JH
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8BEGIN {
9 our $hasgr;
10 eval { my @n = getgrgid 0 };
11 $hasgr = 1 unless $@ && $@ =~ /unimplemented/;
12 unless ($hasgr) { print "1..0 # Skip: no getgrgid\n"; exit 0 }
13 use Config;
14 $hasgr = 0 unless $Config{'i_grp'} eq 'define';
15 unless ($hasgr) { print "1..0 # Skip: no grp.h\n"; exit 0 }
16}
17
18BEGIN {
19 our @grent = getgrgid 0; # This is the function getgrgid.
20 unless (@grent) { print "1..0 # Skip: no gid 0\n"; exit 0 }
21}
22
23print "1..5\n";
24
25use User::grent;
26
27print "ok 1\n";
28
29my $grent = getgrgid 0; # This is the OO getgrgid.
30
31print "not " unless $grent->gid == 0;
32print "ok 2\n";
33
34print "not " unless $grent->name == $grent[0];
35print "ok 3\n";
36
37print "not " unless $grent->passwd eq $grent[1];
38print "ok 4\n";
39
40print "not " unless $grent->gid == $grent[2];
41print "ok 5\n";
42
43# Testing pretty much anything else is unportable.
44