From b9b7771ce58da2ecf93911e496b1fe92571d402c Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Wed, 20 Feb 2019 02:27:42 -0600 Subject: [PATCH] more work on tests --- Parse-Netstat-Search/t/search.t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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);