Test::Class Class Filter
use Test::Class::Load 't/lib'; | |
# | |
# I feel that there's a better way to do this. | |
# Also if no tests run then no plan is emitted, shouldn't Test::Class deal with this? | |
# | |
# Regexes are not validated. | |
# | |
if($ENV{TEST_CLASS}) { | |
Test::Class->add_filter(sub { | |
my ($class, $method) = @_; | |
my ($wanted_class, $wanted_method) = split qr'\.', $ENV{TEST_CLASS}, 2; | |
my $match = $class =~ /$wanted_class/; | |
# If TEST_METHOD is set let Test::Class do the filtering | |
if($match && $wanted_method && !$ENV{TEST_METHOD}) { | |
$match = $method =~ /$wanted_method/ | |
} | |
$match; | |
}); | |
} | |
Test::Class->runtests; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment