Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions lib/Test/Class.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ use Test::Class::MethodInfo;

our $VERSION = '0.37';

my $Check_block_has_run;
{
no warnings 'void';
CHECK { $Check_block_has_run = 1 };
}

use constant NO_PLAN => "no_plan";
use constant SETUP => "setup";
use constant TEST => "test";
Expand Down Expand Up @@ -92,7 +86,7 @@ sub _is_public_method {
return 1;
}

sub Test : ATTR(CODE,RAWDATA) {
sub Test : ATTR(CODE,RAWDATA,BEGIN) {
my ($class, $symbol, $code_ref, $attr, $args) = @_;
if ($symbol eq "ANON") {
warn "cannot test anonymous subs - you probably loaded a Test::Class too late (after the CHECK block was run). See 'A NOTE ON LOADING TEST CLASSES' in perldoc Test::Class for more details\n";
Expand All @@ -105,7 +99,7 @@ sub Test : ATTR(CODE,RAWDATA) {
};
};

sub Tests : ATTR(CODE,RAWDATA) {
sub Tests : ATTR(CODE,RAWDATA,BEGIN) {
my ($class, $symbol, $code_ref, $attr, $args) = @_;
$args ||= 'no_plan';
Test( $class, $symbol, $code_ref, $attr, $args );
Expand Down Expand Up @@ -346,8 +340,6 @@ sub _test_classes {
};

sub runtests {
die "Test::Class was loaded too late (after the CHECK block was run). See 'A NOTE ON LOADING TEST CLASSES' in perldoc Test::Class for more details\n"
unless $Check_block_has_run;
my @tests = @_;
if (@tests == 1 && !ref($tests[0])) {
my $base_class = shift @tests;
Expand Down
10 changes: 10 additions & 0 deletions t/WarnCatch.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package t::WarnCatch;

my $warning;
$SIG{__WARN__} = sub { $warning = "@_" };

sub Caught { $warning }

1;


7 changes: 2 additions & 5 deletions t/override.t
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ use strict;
use warnings;
use Test::More tests => 1;

my $warning;

BEGIN {

$SIG{ __WARN__ } = sub { $warning = "@_" };
use t::WarnCatch; # has to be use so that it runs earlier than BEGIN

{
package Base::Test;
Expand All @@ -25,5 +22,5 @@ BEGIN {
}
}

like $warning, qr/overriding public method/,
like t::WarnCatch::Caught, qr/overriding public method/,
'cannot override a public method with a test method';
11 changes: 0 additions & 11 deletions t/rt17264.t

This file was deleted.