On Sunday, October 21, Richard Hainsworth wrote:
> so .. either I use your suggestion of 'exit note $message' which I find
> elegant, but so far difficult to test.
You could always wrap things, e.g. something like --
my ( $exit-args, $note-args );
&exit.wrap: -> $status { $exit-args = $status; fail }
¬e.wrap: -> |c { $note-args = c; callsame; }
$*ERR.^find_method('print').wrap: -> |c { True; }
sub run {
exit note 'bye';
}
use Test;
try run;
is $note-args, 'bye', 'output correct';
is $exit-args.Int, 1, 'exit status is 1';
done-testing;