all works nicely now
This commit is contained in:
parent
1593c53230
commit
6db5bfbe34
|
@ -141,10 +141,10 @@ sub new{
|
|||
$self->{ptrs}=$args{ptrs};
|
||||
}
|
||||
if ( defined( $args{lptrs}[0] ) ){
|
||||
$self->{lptrs}=$args{lptrs};
|
||||
$self->{lptrs}=\@{ $args{lptrs} };
|
||||
}
|
||||
if ( defined( $args{fptrs}[0] ) ){
|
||||
$self->{fptrs}=$args{fptrs};
|
||||
$self->{fptrs}=\@{ $args{fptrs} };
|
||||
}
|
||||
|
||||
return $self;
|
||||
|
|
|
@ -6,7 +6,7 @@ use Test::More;
|
|||
use Net::Connection;
|
||||
|
||||
BEGIN {
|
||||
use_ok( 'Net::Connection::Match::PTR' ) || print "Bail out!\n";
|
||||
use_ok( 'Net::Connection::Match::RegexPTR' ) || print "Bail out!\n";
|
||||
}
|
||||
|
||||
my $connection_args={
|
||||
|
@ -22,25 +22,25 @@ my $connection_args={
|
|||
|
||||
my %args=(
|
||||
ptrs=>[
|
||||
'foo.bar',
|
||||
'foo',
|
||||
],
|
||||
);
|
||||
my %largs=(
|
||||
lptrs=>[
|
||||
'foo.bar',
|
||||
lptrs=>[
|
||||
'bar',
|
||||
],
|
||||
);
|
||||
my %fargs=(
|
||||
fptrs=>[
|
||||
'foo.bar',
|
||||
],
|
||||
);
|
||||
fptrs=>[
|
||||
'bar',
|
||||
],
|
||||
);
|
||||
my $checker;
|
||||
|
||||
# makes sure we error with empty args
|
||||
my $worked=0;
|
||||
eval{
|
||||
$checker=Net::Connection::Match::PTR->new();
|
||||
$checker=Net::Connection::Match::RegexPTR->new();
|
||||
$worked=1;
|
||||
};
|
||||
ok( $worked eq '0', 'empty init check') or diag('Calling new with empty args worked');
|
||||
|
@ -48,10 +48,10 @@ ok( $worked eq '0', 'empty init check') or diag('Calling new with empty args wor
|
|||
# makes sure we can init with general good args
|
||||
$worked=0;
|
||||
eval{
|
||||
$checker=Net::Connection::Match::PTR->new( \%args );
|
||||
$checker=Net::Connection::Match::RegexPTR->new( \%args );
|
||||
$worked=1;
|
||||
};
|
||||
ok( $worked eq '1', 'init check, general') or diag('Calling Net::Connection::Match::PTR->new resulted in... '.$@);
|
||||
ok( $worked eq '1', 'init check, general') or diag('Calling Net::Connection::Match::RegexPTR->new resulted in... '.$@);
|
||||
|
||||
# make sure it will not accept null input
|
||||
my $returned=1;
|
||||
|
@ -73,11 +73,11 @@ my $conn=Net::Connection->new( $connection_args );
|
|||
eval{
|
||||
$returned=$checker->match( $conn );
|
||||
};
|
||||
ok( $returned eq '1', 'general PTR match check, local') or diag('failed to match a Net::Connection for a general PTR check when one of the two matches');
|
||||
ok( $returned eq '1', 'general PTR match check, general local') or diag('failed to match a Net::Connection for a general PTR check when local matches');
|
||||
|
||||
# make sure the general PTR check works, testing foreign
|
||||
$connection_args->{local_ptr}='test';
|
||||
$connection_args->{foreign_ptr}='foo.bar';
|
||||
$connection_args->{foreign_ptr}='foo';
|
||||
$conn=Net::Connection->new( $connection_args );
|
||||
eval{
|
||||
$returned=$checker->match( $conn );
|
||||
|
@ -87,10 +87,10 @@ ok( $returned eq '1', 'general PTR match check, foriegn') or diag('failed to mat
|
|||
# makes sure we can init with local good args
|
||||
$worked=0;
|
||||
eval{
|
||||
$checker=Net::Connection::Match::PTR->new( \%largs );
|
||||
$checker=Net::Connection::Match::RegexPTR->new( \%largs );
|
||||
$worked=1;
|
||||
};
|
||||
ok( $worked eq '1', 'init check, local') or diag('Calling Net::Connection::Match::PTR->new resulted in... '.$@);
|
||||
ok( $worked eq '1', 'init check, local') or diag('Calling Net::Connection::Match::RegexPTR->new resulted in... '.$@);
|
||||
|
||||
# make sure the local PTR check works, testing foreign
|
||||
$returned=0;
|
||||
|
@ -112,10 +112,10 @@ ok( $returned eq '1', 'local PTR match check, local') or diag('did not match a N
|
|||
# makes sure we can init with foreign good args
|
||||
$worked=0;
|
||||
eval{
|
||||
$checker=Net::Connection::Match::PTR->new( \%fargs );
|
||||
$checker=Net::Connection::Match::RegexPTR->new( \%fargs );
|
||||
$worked=1;
|
||||
};
|
||||
ok( $worked eq '1', 'init check, foreign') or diag('Calling Net::Connection::Match::PTR->new resulted in... '.$@);
|
||||
ok( $worked eq '1', 'init check, foreign') or diag('Calling Net::Connection::Match::RegexPTR->new resulted in... '.$@);
|
||||
|
||||
# make sure the foreign PTR check works, testing local
|
||||
$returned=0;
|
||||
|
|
Loading…
Reference in New Issue