diff --git a/Parse-Netstat-Search/t/search.t b/Parse-Netstat-Search/t/search.t index 4fc05c6..5942a0d 100644 --- a/Parse-Netstat-Search/t/search.t +++ b/Parse-Netstat-Search/t/search.t @@ -72,3 +72,22 @@ my $res=[ '0', '1', ], } ]; + +# does a quick test to make sure we have the basics required for the following tests to work +my $res_good=1; +if ( + ( ref( $res ) ne 'ARRAY' ) || + ( ! defined( $res->[2] ) ) || + ( ! defined( $res->[2]->{active_conns} ) ) + ){ + $res_good=0; +} +ok( $res_good eq '1', 'res test') or diag("Test data is bad"); + +my $search=Parse::Netstat::Search->new; + +#return all non-unix connections +my @found=$search->search($res); +ok( $#found eq '5', 'search, all') or diag('"'.$#found.'" number of returned connections for a empty search instead of "5"'); + +done_testing(3);