in reply to Odd output from Test::More

Sidhekin is definitely onto something. Begin looking for fork:
$ cat 641197.t use strict; use warnings; use Test::More qw(no_plan); my $pid = fork; ($pid) ? print "ok 1\n" : print "ok 2\n"; __END__ $ prove 641197.t 641197....ok 1/0Confused test output: test 2 answered after test 2 # No tests run! 641197....dubious Test returned status 255 (wstat 65280, 0xff00) FAILED--1 test script could be run, alas--no output ever seen $
--
Andreas

Replies are listed 'Best First'.
Re^2: Odd output from Test::More
by Bloodnok (Vicar) on Sep 27, 2007 at 12:27 UTC
    TFT Andreas,

    However, there are no explicit calls to fork() in my test script ... nor the code under test ?!

    The really odd thing is that until yesterday, the module wasn't working and I wasn't seeing the errors - however, since I managed to get the module to work, the errors manifested themselves ... the principle change being the adoption of the Hash::Merge module in favour of a homegrown attempt - AFAICT, the Hash::Merge module only employs recursion i.e. I don't believe it to be using fork().

      Yes, a recursive function can also produce similar results:
      $ cat 641197-2.t use strict; use warnings; use Test::More qw(no_plan); sub f { my $i = shift; print "ok $i\n"; return $i < 2 ? 1 : f($i-1) + f($i-2); } f(3); __END__ $ prove 641197-2.t 641197-2....# No tests run! 641197-2....ok 1/0Confused test output: test 2 answered after test 3 Test output counter mismatch [test 4] Test output counter mismatch [test 5] 641197-2....dubious Test returned status 255 (wstat 65280, 0xff00) FAILED--1 test script could be run, alas--no output ever seen
      --
      Andreas
        Thanx again, Andreas ,

        Your snippets clearly illustrate how it the problem might occur - the problem appears to be predicated on the code under test printing a string of the form /^(not )?ok$/ ... however, in my case, neither the code under test nor the test script prints such a string ?!

        Ever more confused ...