* David Fleck <[EMAIL PROTECTED]> [2008-05-17 14:40]:
> (Incidentally, I do declare a plan, a few lines further down in
> the test script:
> 
>  plan tests => scalar (@file_objects) * 17;
> 
> but I didn't think that was needed in the BEGIN block.)

Yes it is. The BEGIN block runs before everything else, and by
that time your `plan` line has not executed, so it leads to the
complaint you are seeing, that you are running a test before you
set a plan. So you would need to put that line in a BEGIN block
above the one with the `use_ok` line.

But is there a reason you are using `use_ok`? I find that people
use it a lot in situations where plain `use` would be better.
Most of the time there is no point continuing on with the rest
of the tests if the module has failed to load. And if it fails
to load with `use`, the test will crash, which the harness will
notice and declare a failure. Most of the time one should be
loading modules with plain `use` in test programs.

I generally have only one test program, `00.load.t`, that tries
to load everything in the distribution with `use_ok`, and bails
out at the end if there are any failures. All other tests just
`use` the modules they need.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to