2008/5/17 David Fleck <[EMAIL PROTECTED]>:
> 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.
As it says here, you ran a test before you set set the plan.
use Test::More tests => 1; # or however many tests you have
BEGIN { use_ok('Statistics::Gtest') };
is what you should be doing.
The puzzling thing is how this ever worked for you. The only thing I
can think of is that somehow a plan was being set from within
Statistics::Gtest,
F
> 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]
>
>