Fix improper handling of expression name

This commit is contained in:
Nathan McCarty 2024-12-31 20:43:41 +00:00
parent cab0cb5ce1
commit 6971949a53
2 changed files with 15 additions and 4 deletions

View file

@ -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;

View file

@ -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 = $<name>.Str;
my @tests;
for $contents.match(&flagged-expression, :g) -> $match {
@tests.push($match<test-name>.Str);
my $test =
Test.new(name => $match<test-name>.Str,
expr => $match<expression-name>.Str);
@tests.push($test);
}
if @tests.elems > 0 {
%tests{$module-name} =