From 9e9903429eb52aabfb247c079fcc29995b4ee51b Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Tue, 31 Dec 2024 16:25:05 +0000 Subject: [PATCH] Scanning checkpoint --- bin/iutils | 24 +++++++++++++++++++----- lib/IUtils.rakumod | 3 +++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bin/iutils b/bin/iutils index b0595e5..9f99a00 100755 --- a/bin/iutils +++ b/bin/iutils @@ -3,8 +3,22 @@ use v6.d; use IUtils; use IUtils::Comments; -unit sub MAIN; - -temp $*CWD = "/home/nathan/Projects/Idris/structures/".IO; - -say scan-packages; +#| Execute the tests in an idris project +multi MAIN( + "test", + Str $project-path?, #= Base directory of the project, defaults to $*CWD +) { + # CD into the project path if needed + chdir($project-path.IO.resolve: :completely) if $project-path; + # Scan for our packages + my @packages = scan-packages; + # Collect tests + my @tests; + for @packages -> $package { + # FIXME + say 'Finding tests for ', $package.ipkg.relative; + for $package.sources -> $source { + say 'Scanning for tests in ', $source; + } + } +} diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 9c4cdf6..d41c8f8 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -28,6 +28,9 @@ sub scan-ipkg(IO::Path:D $ipkg --> PackageInfo:D) { PackageInfo.new(ipkg => $ipkg, root => $ipkg.parent, sources => @sources) } +# TODO: Add some parsing of pack.toml to locate test packages and associate them +# with their source ipkg + #| Scan $*CWD to locate ipkgs and their associated sources sub scan-packages(--> Array[PackageInfo:D]) is export { my PackageInfo:D @ipkgs =