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?


Googling reveals several instances of

    plan tests => $numtests;

where $numtests is the result of some calculation. So there doesn't appear to be anything preventing your approach. Just remember that, if coded as per your example, there cannot be any tests inside BEGIN blocks in the test file, because your call to 'plan' will miss such tests (unless it's first in the BEGIN block).

jimk

Reply via email to