Filtering by module name
This commit is contained in:
parent
75d955f666
commit
f932ddcde5
|
@ -13,6 +13,7 @@ use IUtils::Compiler;
|
|||
multi MAIN(
|
||||
"test",
|
||||
Str $project-path?, #= Base directory of the project, defaults to $*CWD
|
||||
Str :module(:m(:$module-filter)), #= Module to run tests for
|
||||
) {
|
||||
# CD into the project path if needed
|
||||
chdir($project-path.IO.resolve: :completely) if $project-path;
|
||||
|
@ -24,6 +25,10 @@ multi MAIN(
|
|||
my $basedir = $*CWD;
|
||||
my $total-failures = 0;
|
||||
for @runables -> $runable {
|
||||
# Skip entirely if this runable doesn't contain the requested module
|
||||
if $module-filter {
|
||||
next unless $runable.contains-module: $module-filter;
|
||||
}
|
||||
my $package-failures = 0;
|
||||
# Make sure the package is built
|
||||
pack-build $runable.ipkg.relative;
|
||||
|
@ -34,6 +39,10 @@ multi MAIN(
|
|||
colored($runable.ipkg.relative($basedir), 'magenta bold');
|
||||
say "{colored '*', 'yellow bold'} Testing $test-module-name";
|
||||
for $runable.tests.keys -> $module-name {
|
||||
# Skip this module if it's not the one we are looking for
|
||||
if $module-name {
|
||||
next unless $module-name eq $module-filter;
|
||||
}
|
||||
my $module-failures = 0;
|
||||
my $module = $runable.tests{$module-name};
|
||||
next unless $module.tests.elems > 0;
|
||||
|
|
|
@ -69,6 +69,11 @@ class PackageRunables {
|
|||
# TODO: Add benchmarks
|
||||
#| A map from the name of the module to a list of tests
|
||||
has ModuleTests:D %.tests is required;
|
||||
|
||||
#| Check to see if this package contains a given module
|
||||
method contains-module(Str $module-name --> Bool) {
|
||||
%!tests{$module-name}:exists
|
||||
}
|
||||
}
|
||||
|
||||
#| Structure representing the root of what idris considers a package directory,
|
||||
|
|
Loading…
Reference in a new issue