Create a gist now

Instantly share code, notes, and snippets.

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"';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment