clean up error display

This commit is contained in:
Nathan McCarty 2024-12-31 20:35:04 +00:00
parent c5ff918640
commit cab0cb5ce1
2 changed files with 6 additions and 5 deletions

View file

@ -8,6 +8,7 @@ use IUtils::Regexes;
use IUtils::Compiler;
# 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
multi MAIN(
"test",
@ -46,15 +47,14 @@ multi MAIN(
}
my $testf = colored $test, 'underline';
if $! {
# TODO: Don't show stdout if its empty
$module-failures += 1;
my $stdout = $1.err.lines.map(*.indent(8)).join("\n");
say "{colored '+', 'red'} $testf: {colored 'FAIL', 'red bold'}"
.indent(4);
say "stdout:".indent(6);
$!.err.lines.map(*.indent(8)).join("\n");
say "stderr:".indent(6);
$!.err.lines.map(*.indent(8)).join("\n");
say "exit code: {$!.exit-code}"
say $!.err.lines.map(*.indent(8)).join("\n");
say (colored 'exit code', 'red').indent(6),
": {$!.exit-code}";
} else {
say "{colored '+', 'green'} $testf: {colored 'pass', 'green'}"
.indent(4);

View file

@ -66,6 +66,7 @@ sub idris-run(*@cmd) is export {
return $out;
}
# TODO: Special handling for IO Bool to make this eaiser
#| Exec the expression with the given name in the given file
sub idris-exec($expr, $file) is export {
idris-run '--find-ipkg', '--exec', $expr, $file