From: Steve Peters Date: Fri, 23 Dec 2005 00:10:25 +0000 (+0000) Subject: Make hostname.t deal with undefined or blank hostnames and domain X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=efa2a43b6b2997da5efff097885108e28b4cd901;p=p5sagit%2Fp5-mst-13.2.git Make hostname.t deal with undefined or blank hostnames and domain names. p4raw-id: //depot/perl@26458 --- diff --git a/lib/Net/t/hostname.t b/lib/Net/t/hostname.t index 7577158..758d304 100644 --- a/lib/Net/t/hostname.t +++ b/lib/Net/t/hostname.t @@ -48,5 +48,11 @@ my @dummy = grep { defined hostname() and hostname() eq $_ } @domain; ? print "ok 3\n" : print "not ok 3\n"; -hostfqdn() eq hostname() . "." . hostdomain() ? print "ok 4\n" : print "not ok 4\n"; -domainname() eq hostname() . "." . hostdomain() ? print "ok 5\n" : print "not ok 5\n"; +my $name = hostname(); +my $domain = hostdomain(); +if(defined $domain && defined $name && $name ne "" && $domain ne "") { + hostfqdn() eq $name . "." . $domain ? print "ok 4\n" : print "not ok 4\n"; + domainname() eq $name . "." . $domain ? print "ok 5\n" : print "not ok 5\n";} else { + print "ok 4 # SKIP domain not fully defined\n"; + print "ok 5 # SKIP domain not fully defined\n"; +}