So here's a minimal test class program (v0.24):

    package Foo;

    use Test::More;
    use Test::NoWarnings;
    use base 'Test::Class';

    INIT { Test::Class->runtests }

    sub startup   : Tests(startup => 1)  { ok 1 }
    sub setup     : Tests(setup => 1)    { ok 1 }
    sub some_test : Tests(1)             { ok 1 }
    sub teardown  : Tests(teardown => 1) { ok 1 }
    sub shutdown  : Tests(shutdown => 1) { ok 1 }

    1;

That has a couple of issues.  First, the output with 'runtests -v
foo.t':

  foo......1..5
  ok 1
  ok 2 - some test
  ok 3 - some test
  ok 4 - some test
  ok 5
  ok 6 - no warnings
  # Looks like you planned 5 tests but ran 1 extra.
   Dubious, test returned 255 (wstat 65280, 0xff00)
   All 5 subtests passed 

  Test Summary Report
  -------------------
  foo.t (Wstat: 65280 Tests: 6 Failed: 1)
    Failed tests:  6
    Non-zero exit status: 255
    Parse errors: Bad plan.  You planned 5 tests but ran 6.
  Files=1, Tests=6,  0 wallclock secs ( 0.10 cusr +  0.02 csys =  0.12
CPU)

I cannot easily use 'Test::NoWarnings' because that adds an extra test,
thus forcing me to use 'no_plan' with one of my tests.  Is there some
other way around this?

Also, not that when not using test names, the setup and teardown tests
are getting the names of the method they're testing, thus obscuring tht
we're in setup and teardown.

And just to be fair, here's the output when run through 'prove':

  $ prove -v foo.t 
  foo....1..5
  ok 1
  # 
  # Foo->some_test
  ok 2 - some test
  ok 3 - some test
  ok 4 - some test
  ok 5
  ok 6 - no warnings
  # Looks like you planned 5 tests but ran 1 extra.
  dubious
          Test returned status 255 (wstat 65280, 0xff00)
  DIED. FAILED test 6
          Failed 1/5 tests, 80.00% okay
  Failed Test Stat Wstat Total Fail  List of Failed
  -------------------------------------------------------------------
  foo.t        255 65280     5    1  6
  Failed 1/1 test scripts. -1/5 subtests failed.
  Files=1, Tests=5,  1 wallclock secs ( 0.11 cusr +  0.03 csys =  0.14
CPU)
  Failed 1/1 test programs. -1/5 subtests failed.

I note that '# Foo->some_test' isn't showing up with 'runtests', so
I'll have to look into that. but other than that, we have the same
issues.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to