NAME
t::Helpers - Perl extension for Helper functions for tests.
SYNOPSIS
use Test::More tests => 2;
use t::Helpers qw/:all/;
is(test_error(sub { die 'argh' }),
'argh',
'died horribly');
is(test_warn(sub { warn 'danger will robinson' }),
'danger will robinson',
'warned nicely');
DESCRIPTION
Common functions to make test scripts a bit easier to read.
test_error($code_ref)
This method runs the code with eval and returns the error. It strips off some common strings from the end of the message including any "at <file> line <number>" strings and any "(@INC contains: .*)".
test_warn($code_ref)
This method runs the code with eval and returns the warning. It strips off any "at <file> line <number>" specific part(s) from the end.