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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Test Files - dynamic test counter
by adrianh (Chancellor) on Apr 26, 2004 at 09:38 UTC | |
by considertheant (Novice) on Apr 26, 2004 at 10:22 UTC |