Implement support for IO Bool tests
This commit is contained in:
parent
c089685a2a
commit
09ac7506ee
4 changed files with 49 additions and 11 deletions
|
@ -4,6 +4,7 @@ unit module IUtils;
|
|||
need IUtils::IDEMode;
|
||||
|
||||
use IUtils::Regexes;
|
||||
use IUtils::Compiler;
|
||||
|
||||
use paths;
|
||||
|
||||
|
@ -13,6 +14,8 @@ class Test {
|
|||
has Str:D $.name is required;
|
||||
#| The expression name of the test
|
||||
has Str:D $.expr is required;
|
||||
#| The output type of the test
|
||||
has ExprOutput:D $.output-type is required;
|
||||
}
|
||||
|
||||
#| Structure representing the tests in a module
|
||||
|
@ -51,9 +54,17 @@ class PackageInfo {
|
|||
my $module-name = $<name>.Str;
|
||||
my @tests;
|
||||
for $contents.match(&flagged-expression, :g) -> $match {
|
||||
my $output-type = do
|
||||
given $match<output-type> {
|
||||
when * eq '()' {succeed Unit};
|
||||
when * eq 'Bool' {succeed Boolean};
|
||||
when * eq 'Either' {succeed Either};
|
||||
};
|
||||
say $output-type;
|
||||
my $test =
|
||||
Test.new(name => $match<test-name>.Str,
|
||||
expr => $match<expression-name>.Str);
|
||||
expr => $match<expression-name>.Str,
|
||||
output-type => $output-type);
|
||||
@tests.push($test);
|
||||
}
|
||||
if @tests.elems > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue