On 19 Nov 2007, at 11:04, Ovid wrote:
[snip]
That avoids the overhead of reloading perl and the modules multiple times. However, each .yml file defines its own test count and I don't want 'no_plan'. What I really want to do is this:

  use Test::More 'deferred_plan'
  my $plan = 0;

  foreach my $test ( find_tests() ) {

      $plan += runtest($test);  # returns count

  }
  plan $plan;
[snip]

For this particular case I would just do:

  use Test::More 'no_plan';
  my $builder = Test::More->builder;
  foreach my $test ( find_tests() ) {
      my $initial_count = $builder->current_test;
      my $expected_num_tests = runtest($test);
      is $builder->current_test,
         $initial_count + $expected_num_tests,
         "expected $expected_count tests in $test
  }

:-)

Cheers,

Adrian

Reply via email to