Skip to content

Instantly share code, notes, and snippets.

@sshaw sshaw/00run.t
Created Jan 21, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.