David Golden wrote:
More often, I find myself creating some data structure to define test
cases and then:
plan tests => $fixed + $tests_per_case * @cases;
Once I've defined the basic tests, I'm usually adding cases rather
than changing the per-case test count, so the total test count takes
care of itself.
I often use this solution, and, for the test scripts that don't fit
this, I usually count tests by small blocs, letting Perl calculate
the total:
use Test::More;
my $tests;
plan tests => $tests;
BEGIN { $tests += n }
# paragraph of code with n tests
BEGIN { $tests += m }
# paragraph of code with m tests
# etc
That's very simple and when adding new tests, I only have to update
the number of tests in the BEGIN that immediately precedes the
corresponding code.
--
Sébastien Aperghis-Tramoni
Close the world, txEn eht nepO.