The POD for Test::More states:

         use Test::More tests => $Num_Tests;
         # or
         use Test::More qw(no_plan);
         # or
         use Test::More skip_all => $reason;

Test::More is asking you to be predictive about the number of tests that you plan on running. This way, you have the ability to determine if you didn't run enough tests or if you ran too many tests (think uncontrolled loops).

--
John "Frotz" Fa'atuai
[EMAIL PROTECTED]


On Sat, 17 May 2008 05:35:27 -0700, David Fleck <[EMAIL PROTECTED]> wrote:

I hope someone can help out this novice test writer. I have a module that
runs several test scripts, and recently they have started to fail on some
tester's machines.  The tests work fine for me, and I can't see anything
in the Test::More documentation that tells me what's going on.

An example test script starts like this:


# Before `make install' is performed this script should be runnable with
  # `make test'. After `make install' it should work as `perl Gtest.t'
 #########################
 use Test::More; BEGIN { use_ok('Statistics::Gtest') };
 #########################
 my $twothreefile = "t/2x3int.txt";
[... rest of file follows ...]


and, increasingly, the test fails, according to the emails I get and the
test results I see on CPAN:


/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/file_input..........You tried to run a test without a plan at t/file_input.t line 6.
  BEGIN failed--compilation aborted at t/file_input.t line 6.
   Dubious, test returned 255 (wstat 65280, 0xff00)
   ANo subtests run


Line 6 is the 'use Test::More' line, which is copied pretty much straight
from the POD.  But again, it works fine on my one local machine.  What's
going on here? And how do I fix it?

(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.)

--
David Fleck
[EMAIL PROTECTED]




--
--
John "Frotz" Fa'atuai
http://www.frotzware.com/

Reply via email to