From 6971949a537f4f9ef795ae290ad0ec89df1c0695 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Tue, 31 Dec 2024 20:43:41 +0000 Subject: [PATCH] Fix improper handling of expression name --- bin/iutils | 4 ++-- lib/IUtils.rakumod | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bin/iutils b/bin/iutils index 2000339..d4dc3c1 100755 --- a/bin/iutils +++ b/bin/iutils @@ -43,9 +43,9 @@ multi MAIN( for $module.tests -> $test { try { # FIXME this doesn't actually capture the exit code - idris-exec $test, $module.source.relative; + idris-exec $test.expr, $module.source.relative; } - my $testf = colored $test, 'underline'; + my $testf = colored $test.name, 'underline'; if $! { # TODO: Don't show stdout if its empty $module-failures += 1; diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 9d7f1df..620c700 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -7,6 +7,14 @@ use IUtils::Regexes; use paths; +#| Structure representing a test +class Test { + #| The name of the test + has Str:D $.name is required; + #| The expression name of the test + has Str:D $.expr is required; +} + #| Structure representing the tests in a module class ModuleTests { #| The name of this module @@ -14,7 +22,7 @@ class ModuleTests { #| The source file of this module has IO::Path:D $.source is required; #| A list of the associated tests this module has - has Str:D @.tests is required; + has Test:D @.tests is required; } #| Structure representing all of the runables assocated with a project @@ -43,7 +51,10 @@ class PackageInfo { my $module-name = $.Str; my @tests; for $contents.match(&flagged-expression, :g) -> $match { - @tests.push($match.Str); + my $test = + Test.new(name => $match.Str, + expr => $match.Str); + @tests.push($test); } if @tests.elems > 0 { %tests{$module-name} =