X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Fnet-hostent.t;h=abc5b9292f9895c372ea76e3f54c43c1072225de;hb=569bd3158af2276a406770e3d68e76b7da59b730;hp=a0ec7bd9702a94de7511e5863306b639e8cd400f;hpb=d37f6f5fe34e88f2b6ade25bfb19b086ec071db4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/net-hostent.t b/t/lib/net-hostent.t index a0ec7bd..abc5b92 100644 --- a/t/lib/net-hostent.t +++ b/t/lib/net-hostent.t @@ -41,12 +41,32 @@ print "ok 5\n"; # VMS returns "LOCALHOST" under tcp/ip services V4.1 ECO 2, possibly others # OS/390 returns localhost.YADDA.YADDA -if ($^O eq 'MSWin32') { +if ($^O eq 'MSWin32' or $^O eq 'cygwin') { print "ok $_ # skipped on win32\n" for (6,7); } else { - print "not " unless $h->name =~ /^localhost(?:\..+)?$/i; - print "ok 6 # ",$h->name,"\n"; + my $in_alias; + unless ($h->name =~ /^localhost(?:\..+)?$/i) { + foreach (@{$h->aliases}) { + if (/^localhost(?:\..+)?$/i) { + $in_alias = 1; + last; + } + } + print "not " unless $in_alias; + } # Else we found it as the hostname + print "ok 6 # ",$h->name, " ", join (",", @{$h->aliases}), "\n"; - print "not " unless $i->name =~ /^localhost(?:\..+)?$/i; - print "ok 7 # ",$i->name,"\n"; + if ($in_alias) { + # If we found it in the aliases before, expect to find it there again. + foreach (@{$h->aliases}) { + if (/^localhost(?:\..+)?$/i) { + undef $in_alias; # This time, clear the flag if we see "localhost" + last; + } + } + print "not " if $in_alias; + } else { + print "not " unless $i->name =~ /^localhost(?:\..+)?$/i; + } + print "ok 7 # ",$h->name, " ", join (",", @{$h->aliases}), "\n"; }