Commit | Line | Data |
6888c95f |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | } |
7 | |
8 | BEGIN { |
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 | |
18 | BEGIN { |
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 | |
23 | print "1..5\n"; |
24 | |
25 | use User::grent; |
26 | |
27 | print "ok 1\n"; |
28 | |
29 | my $grent = getgrgid 0; # This is the OO getgrgid. |
30 | |
31 | print "not " unless $grent->gid == 0; |
32 | print "ok 2\n"; |
33 | |
34 | print "not " unless $grent->name == $grent[0]; |
35 | print "ok 3\n"; |
36 | |
37 | print "not " unless $grent->passwd eq $grent[1]; |
38 | print "ok 4\n"; |
39 | |
40 | print "not " unless $grent->gid == $grent[2]; |
41 | print "ok 5\n"; |
42 | |
43 | # Testing pretty much anything else is unportable. |
44 | |