From: Jarkko Hietaniemi Date: Tue, 29 May 2001 14:31:57 +0000 (+0000) Subject: Add test for User::grent. Portability doubtful. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6888c95f080b12de4d5fbcdaa17f123631d8b9e7;p=p5sagit%2Fp5-mst-13.2.git Add test for User::grent. Portability doubtful. p4raw-id: //depot/perl@10286 --- diff --git a/MANIFEST b/MANIFEST index b6b8fca..2bd1e92 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1669,6 +1669,7 @@ t/lib/u-reftype.t Scalar::Util t/lib/u-sum.t List::Util t/lib/u-tainted.t Scalar::Util t/lib/u-weak.t Scalar::Util +t/lib/user-grent.t See if User::grwent works t/lib/user-pwent.t See if User::pwent works t/lib/xs-typemap.t test that typemaps work t/op/64bitint.t See if 64 bit integers work diff --git a/t/lib/1_compile.t b/t/lib/1_compile.t index 3e4ea6f..132eb22 100644 --- a/t/lib/1_compile.t +++ b/t/lib/1_compile.t @@ -234,6 +234,7 @@ Time::HiRes Time::Local Time::Piece UNIVERSAL +User::grent User::pwent XS::Typemap attrs diff --git a/t/lib/user-grent.t b/t/lib/user-grent.t new file mode 100644 index 0000000..760b814 --- /dev/null +++ b/t/lib/user-grent.t @@ -0,0 +1,44 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +BEGIN { + our $hasgr; + eval { my @n = getgrgid 0 }; + $hasgr = 1 unless $@ && $@ =~ /unimplemented/; + unless ($hasgr) { print "1..0 # Skip: no getgrgid\n"; exit 0 } + use Config; + $hasgr = 0 unless $Config{'i_grp'} eq 'define'; + unless ($hasgr) { print "1..0 # Skip: no grp.h\n"; exit 0 } +} + +BEGIN { + our @grent = getgrgid 0; # This is the function getgrgid. + unless (@grent) { print "1..0 # Skip: no gid 0\n"; exit 0 } +} + +print "1..5\n"; + +use User::grent; + +print "ok 1\n"; + +my $grent = getgrgid 0; # This is the OO getgrgid. + +print "not " unless $grent->gid == 0; +print "ok 2\n"; + +print "not " unless $grent->name == $grent[0]; +print "ok 3\n"; + +print "not " unless $grent->passwd eq $grent[1]; +print "ok 4\n"; + +print "not " unless $grent->gid == $grent[2]; +print "ok 5\n"; + +# Testing pretty much anything else is unportable. +