Compare commits

..

No commits in common. "775652c6cf46f5399ecbdea51c14a4f328ab97b2" and "b28b91d5d2c98fdc0ddb4e873441c6818248dd01" have entirely different histories.

5 changed files with 15 additions and 27 deletions

12
.envrc Normal file
View file

@ -0,0 +1,12 @@
use flake ~/Projects/Nix/system#idris2
export PACK_DIR=$PWD/.env/pack
export HEDGEHOG_COLOR=true
PATH_add $PWD/.env/pack/bin
PATH_add $PWD/.scripts/bin
export RAKUDO_LINE_EDITOR=Readline
export RAKULIB=$PWD/lib
PATH_add ~/.raku/bin

1
.gitignore vendored
View file

@ -7,4 +7,3 @@ tmp/
**/build/
**/.precomp/
.env
.envrc

View file

@ -7,18 +7,12 @@ use IUtils;
use IUtils::Regexes;
use IUtils::Compiler;
my %*SUB-MAIN-OPTS =
:named-anywhere,
:bundling,
;
# TODO: Add filtering for tests based on module/name
# TODO: Move some of this functionality into methods for the relevant structs
#| Execute the tests in an idris project
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;
@ -30,10 +24,6 @@ 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;
@ -44,10 +34,6 @@ 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;

View file

@ -69,11 +69,6 @@ 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,
@ -127,12 +122,8 @@ sub scan-ipkg(IO::Path:D $ipkg --> PackageInfo:D) {
'"' $<value>=[<-["]>*] '"' /)<value>
// "src";
my sub is-source(Str:D $file --> Bool) {
return $file.ends-with(".idr") || $file.ends-with(".md");
}
my IO::Path:D @sources =
paths($ipkg.parent.add($src-dir), :file(&is-source)).map(*.IO);
paths($ipkg.parent.add($src-dir), :file(*.ends-with(".idr"))).map(*.IO);
PackageInfo.new(ipkg => $ipkg, root => $ipkg.parent, sources => @sources)
}

View file

@ -12,12 +12,12 @@ my token flag { \@ \@ <type> }
my token name { <[\w \-]>+ }
my token test-name { \V+ }
my token comment-line { \h* <&comment-start> \V* \v }
my token comment-line { <&comment-start> \V* \v }
my regex flagged-expression is export {
\h* <&comment-start> \h* <flag> \h* <test-name> \V* \v
<comment-line>*
\h* <expression-name=&name> \h+ \: \h+ 'IO' \h+ <output-type> \V* \v
<expression-name=&name> \h+ \: \h+ 'IO' \h+ <output-type> \V* \v
}
my regex module-name is export {