From: Jarkko Hietaniemi Date: Tue, 29 May 2001 14:53:10 +0000 (+0000) Subject: Add test for Net::netent. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cdbd8744255340e4922b281574dca2cdb92a747b;p=p5sagit%2Fp5-mst-13.2.git Add test for Net::netent. p4raw-id: //depot/perl@10287 --- diff --git a/MANIFEST b/MANIFEST index 2bd1e92..56a8112 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1579,6 +1579,7 @@ t/lib/mimeb64u.t see whether MIME::Base64 works t/lib/mimeqp.t see whether MIME::QuotedPrint works t/lib/ndbm.t See if NDBM_File works t/lib/net-hostent.t See if Net::hostent works +t/lib/net-nent.t See if Net::netent works t/lib/next.t See if NEXT works t/lib/odbm.t See if ODBM_File works t/lib/opcode.t See if Opcode works diff --git a/t/lib/1_compile.t b/t/lib/1_compile.t index 132eb22..cf5a9c1 100644 --- a/t/lib/1_compile.t +++ b/t/lib/1_compile.t @@ -193,6 +193,7 @@ Math::Trig NDBM_File NEXT Net::hostent +Net::netent ODBM_File Opcode PerlIO diff --git a/t/lib/net-nent.t b/t/lib/net-nent.t new file mode 100644 index 0000000..e73122c --- /dev/null +++ b/t/lib/net-nent.t @@ -0,0 +1,36 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +BEGIN { + our $hasne; + eval { my @n = getnetbyname "loopback" }; + $hasne = 1 unless $@ && $@ =~ /unimplemented/; + unless ($hasne) { print "1..0 # Skip: no getnetbyname\n"; exit 0 } + use Config; + $hasne = 0 unless $Config{'i_netdb'} eq 'define'; + unless ($hasne) { print "1..0 # Skip: no netdb.h\n"; exit 0 } +} + +BEGIN { + our @netent = getnetbyname "loopback"; # This is the function getnetbyname. + unless (@netent) { print "1..0 # Skip: no loopback net\n"; exit 0 } +} + +print "1..2\n"; + +use Net::netent; + +print "ok 1\n"; + +my $netent = getnetbyname "loopback"; # This is the OO getnetbyname. + +print "not " unless $netent->name eq $netent[0]; +print "ok 2\n"; + +# Testing pretty much anything else is unportable; +# e.g. the canonical name of the "loopback" net may be "loop". +