diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..f1cd7c1 --- /dev/null +++ b/.envrc @@ -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 diff --git a/.gitignore b/.gitignore index a0dc5b9..ff5fe8a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,3 @@ tmp/ **/build/ **/.precomp/ .env -.envrc diff --git a/bin/iutils b/bin/iutils index 7ba498e..a7334ad 100755 --- a/bin/iutils +++ b/bin/iutils @@ -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; diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 0540148..007c255 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -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) { '"' $=[<-["]>*] '"' /) // "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) } diff --git a/lib/IUtils/Regexes.rakumod b/lib/IUtils/Regexes.rakumod index fd2ae72..5ea28e1 100644 --- a/lib/IUtils/Regexes.rakumod +++ b/lib/IUtils/Regexes.rakumod @@ -12,12 +12,12 @@ my token flag { \@ \@ } 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* \h* \V* \v * - \h* \h+ \: \h+ 'IO' \h+ \V* \v + \h+ \: \h+ 'IO' \h+ \V* \v } my regex module-name is export {