Sync-up tests with libnet distribution
[p5sagit/p5-mst-13.2.git] / lib / Net / t / hostname.t
1 #!./perl -w
2
3 BEGIN {
4     unless (-d 'blib') {
5         chdir 't' if -d 't';
6         @INC = '../lib';
7     }
8 }
9
10 use Net::Domain qw(hostname domainname hostdomain);
11 use Net::Config;
12
13 unless($NetConfig{test_hosts}) {
14     print "1..0\n";
15     exit 0;
16 }
17
18 print "1..2\n";
19
20 $domain = domainname();
21
22 if(defined $domain && $domain ne "") {
23  print "ok 1\n";
24 }
25 else {
26  print "not ok 1\n";
27 }
28
29 # This check thats hostanme does not overwrite $_
30 my @domain = qw(foo.example.com bar.example.jp);
31 my @copy = @domain;
32
33 my @dummy = grep { hostname eq $_ } @domain;
34
35 ($domain[0] && $domain[0] eq $copy[0])
36   ? print "ok 2\n"
37   : print "not ok 2\n";