public
Created

  • Download Gist
exit_status.t
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use 5.014;
use Test::Most;
use Test::Trap;
 
# Evaluating Test::Trap
# Wish the global $trap was returned by the exported trap method.
 
my @response = trap {
say {*STDOUT} 'stdout';
say {*STDERR} 'stderr';
exit 1;
};
 
is $trap->exit, 1, 'exit code is 1';
is $trap->stdout, "stdout\n", '$trap->stdout, "stdout\n"';
is $trap->stderr, "stderr\n", '$trap->stderr, "stderr\n"';
 
done_testing;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.