Yitzchak Scott-Thoennes wrote:

I remember working with some module that had tests something like:

  use Test::More;
  plan tests => numtests();

  ...

  is($foo, $bar, 'foo is bar');

  sub numtests { 13 }

So that when you added a new test to the bottom, the number to modify
was right there also.  Ring a bell with anyone?

Didn't see that one, but if you want to simplify the count of the number of tests, a simple solution is to use BEGIN blocs:

    use Test::More;
    my $tests;
    plan tests => $tests;

    BEGIN { $tests += XX }
    # bloc of tests
    # ...

    BEGIN { $tests += XX }
    # bloc of tests
    # ...


Sébastien Aperghis-Tramoni
 -- - --- -- - -- - --- -- - --- -- - --[ http://maddingue.org ]
Close the world, txEn eht nepO

Reply via email to