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