On 7/20/06, chromatic <[EMAIL PROTECTED]> wrote:
I don't understand this. I have a Vim macro that switches between:
use Test::More 'no_plan';
... and:
use Test::More tests => 1;
When I work on a test suite, I switch off the plan. When I finish, I look at
the number of tests run, switch on the plan, and with my cursor helpfully
at '1', I change the number of tests.
You're right. This works perfectly when the script has a well defined
number of tests. Nothing can be simpler. But it is just boring some
times: when I wrote tests for generating random correct ids in
Business::BR::Ids, I had to wrote an expression for the number of
tests which varied with the number of implemented codes and with the
size of the sample I wanted to test. When I made changes, I usually
decreased radically the size of the sample to not be drowned in "not
ok". When everything was alright, I returned to sample sizes of 100 or
so. It would have been easier if I could count with simple expressions
and tell the plan later.
And it also does not solve the original Gabor's problem: what to do
when the number of tests come from an external source and is too
expensive to compute, like using
"SELECT COUNT(*)" to get a row count for a SQL query and then do the
query again for retrieving the rows.