1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
# -*-perl-*-
# $Id: 00-load.t 666 2007-06-21 15:08:49Z olaf $
use Test::More tests => 79;
use strict;
BEGIN {
use_ok('Net::DNS');
use_ok('Net::DNS::Resolver::Recurse');
use_ok('Net::DNS::Nameserver');
use_ok('Net::DNS::Resolver::Cygwin');
# can't test windows, has registry stuff
}
diag("\nThese tests were ran with:\n");
diag("Net::DNS::VERSION: ".
$Net::DNS::VERSION);
diag("set environment variable NET_DNS_DEBUG to get all versions");
sub is_rr_loaded {
my ($rr) = @_;
return $INC{"Net/DNS/RR/$rr.pm"} ? 1 : 0;
}
# Skip all Net::DNS::SEC related records.
my %skip = map { $_ => 1 } qw(SIG NXT KEY DS NSEC RRSIG DNSKEY DLV NSEC3 NSEC3PARAM);
my @rrs = grep { !$skip{$_} } keys %Net::DNS::RR::RR;
#
# Make sure that we haven't loaded any of the RR classes
foreach my $rr (@rrs) {
ok(!is_rr_loaded($rr), "Net::DNS::RR::$rr is not loaded");
}
#
# Check that we can load all the RR modules.
#
foreach my $rr (@rrs) {
my $class;
my $version;
eval { $class = Net::DNS::RR->_get_subclass($rr); };
diag($@) if $@;
ok(is_rr_loaded($rr), "$class loaded");
next unless is_rr_loaded($rr);
}
#
# Did we get things imported correctly?
#
{
no strict 'refs';
foreach my $sym (@Net::DNS::EXPORT) {
ok(defined &{$sym}, "$sym is imported");
}
}
|