Compare commits
No commits in common. "775652c6cf46f5399ecbdea51c14a4f328ab97b2" and "b28b91d5d2c98fdc0ddb4e873441c6818248dd01" have entirely different histories.
775652c6cf
...
b28b91d5d2
5 changed files with 15 additions and 27 deletions
12
.envrc
Normal file
12
.envrc
Normal 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
1
.gitignore
vendored
|
@ -7,4 +7,3 @@ tmp/
|
||||||
**/build/
|
**/build/
|
||||||
**/.precomp/
|
**/.precomp/
|
||||||
.env
|
.env
|
||||||
.envrc
|
|
||||||
|
|
14
bin/iutils
14
bin/iutils
|
@ -7,18 +7,12 @@ use IUtils;
|
||||||
use IUtils::Regexes;
|
use IUtils::Regexes;
|
||||||
use IUtils::Compiler;
|
use IUtils::Compiler;
|
||||||
|
|
||||||
my %*SUB-MAIN-OPTS =
|
|
||||||
:named-anywhere,
|
|
||||||
:bundling,
|
|
||||||
;
|
|
||||||
|
|
||||||
# TODO: Add filtering for tests based on module/name
|
# TODO: Add filtering for tests based on module/name
|
||||||
# TODO: Move some of this functionality into methods for the relevant structs
|
# TODO: Move some of this functionality into methods for the relevant structs
|
||||||
#| Execute the tests in an idris project
|
#| Execute the tests in an idris project
|
||||||
multi MAIN(
|
multi MAIN(
|
||||||
"test",
|
"test",
|
||||||
Str $project-path?, #= Base directory of the project, defaults to $*CWD
|
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
|
# CD into the project path if needed
|
||||||
chdir($project-path.IO.resolve: :completely) if $project-path;
|
chdir($project-path.IO.resolve: :completely) if $project-path;
|
||||||
|
@ -30,10 +24,6 @@ multi MAIN(
|
||||||
my $basedir = $*CWD;
|
my $basedir = $*CWD;
|
||||||
my $total-failures = 0;
|
my $total-failures = 0;
|
||||||
for @runables -> $runable {
|
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;
|
my $package-failures = 0;
|
||||||
# Make sure the package is built
|
# Make sure the package is built
|
||||||
pack-build $runable.ipkg.relative;
|
pack-build $runable.ipkg.relative;
|
||||||
|
@ -44,10 +34,6 @@ multi MAIN(
|
||||||
colored($runable.ipkg.relative($basedir), 'magenta bold');
|
colored($runable.ipkg.relative($basedir), 'magenta bold');
|
||||||
say "{colored '*', 'yellow bold'} Testing $test-module-name";
|
say "{colored '*', 'yellow bold'} Testing $test-module-name";
|
||||||
for $runable.tests.keys -> $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-failures = 0;
|
||||||
my $module = $runable.tests{$module-name};
|
my $module = $runable.tests{$module-name};
|
||||||
next unless $module.tests.elems > 0;
|
next unless $module.tests.elems > 0;
|
||||||
|
|
|
@ -69,11 +69,6 @@ class PackageRunables {
|
||||||
# TODO: Add benchmarks
|
# TODO: Add benchmarks
|
||||||
#| A map from the name of the module to a list of tests
|
#| A map from the name of the module to a list of tests
|
||||||
has ModuleTests:D %.tests is required;
|
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,
|
#| 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>
|
'"' $<value>=[<-["]>*] '"' /)<value>
|
||||||
// "src";
|
// "src";
|
||||||
|
|
||||||
my sub is-source(Str:D $file --> Bool) {
|
|
||||||
return $file.ends-with(".idr") || $file.ends-with(".md");
|
|
||||||
}
|
|
||||||
|
|
||||||
my IO::Path:D @sources =
|
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)
|
PackageInfo.new(ipkg => $ipkg, root => $ipkg.parent, sources => @sources)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,12 @@ my token flag { \@ \@ <type> }
|
||||||
my token name { <[\w \-]>+ }
|
my token name { <[\w \-]>+ }
|
||||||
my token test-name { \V+ }
|
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 {
|
my regex flagged-expression is export {
|
||||||
\h* <&comment-start> \h* <flag> \h* <test-name> \V* \v
|
\h* <&comment-start> \h* <flag> \h* <test-name> \V* \v
|
||||||
<comment-line>*
|
<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 {
|
my regex module-name is export {
|
||||||
|
|
Loading…
Add table
Reference in a new issue