summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-05-29 14:57:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-29 14:57:15 +0000
commit1d958aa95297aefb06eab911e266eee3836a2fcd (patch)
treeb6663f694ebfaf9688f887665a715fa334557b49
parentcdbd8744255340e4922b281574dca2cdb92a747b (diff)
downloadperl-1d958aa95297aefb06eab911e266eee3836a2fcd.tar.gz
Add test for Net::protoent.
p4raw-id: //depot/perl@10288
-rw-r--r--t/lib/net-pent.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/lib/net-pent.t b/t/lib/net-pent.t
new file mode 100644
index 0000000000..6c5a1547b3
--- /dev/null
+++ b/t/lib/net-pent.t
@@ -0,0 +1,38 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+BEGIN {
+ our $haspe;
+ eval { my @n = getprotobyname "tcp" };
+ $haspe = 1 unless $@ && $@ =~ /unimplemented/;
+ unless ($haspe) { print "1..0 # Skip: no getprotobyname\n"; exit 0 }
+ use Config;
+ $haspe = 0 unless $Config{'i_netdb'} eq 'define';
+ unless ($haspe) { print "1..0 # Skip: no netdb.h\n"; exit 0 }
+}
+
+BEGIN {
+ our @protoent = getprotobyname "tcp"; # This is the function getprotobyname.
+ unless (@protoent) { print "1..0 # Skip: no tcp protocol\n"; exit 0 }
+}
+
+print "1..3\n";
+
+use Net::protoent;
+
+print "ok 1\n";
+
+my $protoent = getprotobyname "tcp"; # This is the OO getprotobyname.
+
+print "not " unless $protoent->name eq $protoent[0];
+print "ok 2\n";
+
+print "not " unless $protoent->proto == $protoent[2];
+print "ok 3\n";
+
+# Testing pretty much anything else is unportable.
+