protocol matching new works and so do the tests for it

这个提交包含在:
Zane C. B-H 2019-07-08 02:10:38 -05:00
父节点 8217f86980
当前提交 bece6d6f1c
共有 2 个文件被更改,包括 6 次插入6 次删除

查看文件

@ -76,7 +76,7 @@ sub new{
};
# run some basic checks to make sure we have the minimum stuff required to work
if ( ! defined( $args{states} ) ){
if ( ! defined( $args{protos} ) ){
die ('No states key specified in the argument hash');
}
if ( ref( \$args{protos} ) eq 'ARRAY' ){

查看文件

@ -46,7 +46,7 @@ my $returned=1;
eval{
$returned=$checker->match;
};
ok( $returned eq '0', 'match undef check') or diag('match accepted undefined input');
ok( $returned eq '0', 'proto undef check') or diag('match accepted undefined input');
# make sure it will not accept a improper ref type
$returned=1;
@ -55,21 +55,21 @@ eval{
};
ok( $returned eq '0', 'match improper ref check') or diag('match accepted a ref other than Net::Connection');
# Create a connection with a matching state and see if it matches
# Create a connection with a matching protocol and see if it matches
my $conn=Net::Connection->new( $connection_args );
$returned=0;
eval{
$returned=$checker->match( $conn );
};
ok( $returned eq '1', 'state match check') or diag('Failed to match a matching good state');
ok( $returned eq '1', 'proto match check') or diag('Failed to match a matching good protocol');
# Create a connection with a non-matching state and make sure it does not match
# Create a connection with a non-matching protocol and make sure it does not match
$connection_args->{proto}='udp4';
$conn=Net::Connection->new( $connection_args );
$returned=1;
eval{
$returned=$checker->match( $conn );
};
ok( $returned eq '0', 'state non-match check') or diag('Matched a state that it should not of');
ok( $returned eq '0', 'proto non-match check') or diag('Matched a protocol that it should not of');
done_testing(7);