Skip to content

Commit

Permalink
eeked up test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianh committed Apr 6, 2008
1 parent 8d3168b commit 059c135
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
0.29 - or the "Oslo QA 2008" release
- Fixed some broken edge cases where you didn't get a plan when you had
tests in a shutdown method, and no tests in the rest of your class
- Test::Class::Load can now be subclassed so you can add your own filters
for what is considered a test class (patch from Cosimo Streppone)
- Described minimum perl as '5.006001' rather than '5.6.1' so old perls
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/Class.pm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ sub runtests {
TEST_OBJECT: foreach my $t (@tests) {
# SHOULD ALSO ALLOW NO_PLAN
next if $t =~ m/^\d+$/;
croak "$t not Test::Class or integer"
croak "$t is not Test::Class or integer"
unless _isa_class( __PACKAGE__, $t );
if (my $reason = $t->SKIP_CLASS) {
_show_header($t, @tests);
Expand Down
11 changes: 11 additions & 0 deletions t/runtests_with_wrong_class.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/perl -T

use strict;
use warnings FATAL => 'all';
use Test::Exception;
use Test::More tests => 2;

BEGIN { use_ok 'Test::Class' };

dies_ok { Test::Class->runtests( 'Not::A::Test::Class' ) }
'runtests dies if we are given something that is not a test class';
20 changes: 20 additions & 0 deletions t/show_plan_in_shutdown.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/perl -T

use strict;
use warnings FATAL => 'all';
use Test::More tests => 1;

my $shutdown_has_run;

{ package My::Test;
use base qw( Test::Class );
use Test::More;

sub shutdown :Test( shutdown ) {
$shutdown_has_run = 1;
}

}

My::Test->runtests( +1 );
ok $shutdown_has_run, "shutdown method has run";

0 comments on commit 059c135

Please sign in to comment.