From 3b8d8a4ecc840df443c58771427e464f506ee096 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 12 Jan 2025 11:57:20 -0500 Subject: [PATCH 1/6] Remove envrc for now --- .envrc | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .envrc diff --git a/.envrc b/.envrc deleted file mode 100644 index f1cd7c1..0000000 --- a/.envrc +++ /dev/null @@ -1,12 +0,0 @@ -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 From 18ad8bcc99640ad105e647138bdacd8b598a9eaf Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 12 Jan 2025 13:18:57 -0500 Subject: [PATCH 2/6] Add support for markdown files as sources --- lib/IUtils.rakumod | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 007c255..3ec2b99 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -122,8 +122,12 @@ 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(*.ends-with(".idr"))).map(*.IO); + paths($ipkg.parent.add($src-dir), :file(&is-source)).map(*.IO); PackageInfo.new(ipkg => $ipkg, root => $ipkg.parent, sources => @sources) } From 0dbafc0cce64095112d14f6bdb991333a98ffe46 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 19 Jan 2025 23:01:52 -0500 Subject: [PATCH 3/6] fix: Handle whitespace in more places --- lib/IUtils/Regexes.rakumod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/IUtils/Regexes.rakumod b/lib/IUtils/Regexes.rakumod index 5ea28e1..fd2ae72 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 { <&comment-start> \V* \v } +my token comment-line { \h* <&comment-start> \V* \v } my regex flagged-expression is export { \h* <&comment-start> \h* \h* \V* \v * - \h+ \: \h+ 'IO' \h+ \V* \v + \h* \h+ \: \h+ 'IO' \h+ \V* \v } my regex module-name is export { From 75d955f666e68324d84cf0a7b98ae53dd190b028 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 20 Jan 2025 16:47:42 -0500 Subject: [PATCH 4/6] Ignore envrc for now --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ff5fe8a..a0dc5b9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/ **/build/ **/.precomp/ .env +.envrc From f932ddcde5524ffafda4f299733835a98a984f25 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 26 Jan 2025 15:23:38 -0500 Subject: [PATCH 5/6] Filtering by module name --- bin/iutils | 9 +++++++++ lib/IUtils.rakumod | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/bin/iutils b/bin/iutils index a7334ad..ae04936 100755 --- a/bin/iutils +++ b/bin/iutils @@ -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; diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 3ec2b99..0540148 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -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, From 775652c6cf46f5399ecbdea51c14a4f328ab97b2 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sun, 26 Jan 2025 15:24:30 -0500 Subject: [PATCH 6/6] Set %*SUB-MAIN-OPTS --- bin/iutils | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/iutils b/bin/iutils index ae04936..7ba498e 100755 --- a/bin/iutils +++ b/bin/iutils @@ -7,6 +7,11 @@ 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