Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created November 8, 2012 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/4042168 to your computer and use it in GitHub Desktop.
Save j1n3l0/4042168 to your computer and use it in GitHub Desktop.
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment