the match function now tests as good
This commit is contained in:
bovenliggende
6fcfbb57d7
commit
290bba0b9e
|
@ -194,12 +194,12 @@ sub match{
|
|||
}
|
||||
|
||||
# Stores the number of hits
|
||||
my $hits;
|
||||
my $hits=0;
|
||||
my $required=0;
|
||||
foreach my $check ( @{ $self->{checks} } ){
|
||||
my $hit;
|
||||
eval{
|
||||
$hit=$check->{check}->($conn);
|
||||
$hit=$check->{check}->match($conn);
|
||||
};
|
||||
|
||||
# If $hits is undef, then one of the checks errored and we skip processing the results.
|
||||
|
@ -220,7 +220,7 @@ sub match{
|
|||
}
|
||||
|
||||
# if these are the same, then we have a match
|
||||
if ( $required == $hits ){
|
||||
if ( $required eq $hits ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,11 +63,18 @@ eval{
|
|||
};
|
||||
ok( $checker->error eq '2', 'match improper ref check') or diag('match accepted a ref other than Net::Connection');
|
||||
|
||||
|
||||
# make sure it will not accept null input
|
||||
eval{
|
||||
$returned=$checker->match();
|
||||
};
|
||||
ok( $checker->error eq '2', 'match null input check') or diag('match accepted a ref other than Net::Connection');
|
||||
ok( $checker->error eq '2', 'match null input check') or diag('match accepted null input');
|
||||
|
||||
done_testing(5);
|
||||
# Create a connection with a matching general port and see if it matches
|
||||
my $conn=Net::Connection->new( $connection_args );
|
||||
$returned=0;
|
||||
eval{
|
||||
$returned=$checker->match($conn);
|
||||
};
|
||||
ok( $returned eq '1', 'match good conn check') or diag('match failed on a connection that should match');
|
||||
|
||||
done_testing(6);
|
||||
|
|
Laden…
Verwijs in nieuw issue