use Carp; our $testcount; BEGIN{#count number of tests dynamically eval{ my $file = "/some_dir/t/test.pl"; open(F, $file) || croak "can't open ***file:$file*** error:$!"; my @f = grep {/ok\(|is\(|like\(/gis} <F>; close F; $testcount = @f; }; if($@){ warn qq|ThrowError:$@|; } } use Test::More tests => $testcount; #{...}#remaining test code
In reply to Test Files - dynamic test counter by considertheant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |