NAME
Test::Run::Trap::Obj - wrapper around Test::Trap for trapping errors.
SYNPOSIS
my $got = Test::Run::Trap::Obj->trap_run({
args => [test_files => ["t/sample-tests/simple"]]
});
$got->field_like("stdout", qr/All tests successful/,
"Everything is OK."
);
DESCRIPTION
This class implements a wrapper around Test::Trap. When an assertion files, the diagnostics prints all the relevant and trapped fields for easy debugging.
METHODS
$trapper->diag_all()
Calls Test::More's diag() with alll the trapped fields, like stdout, stderr, etc.
$trapper->field_like($what, $regex, $message)
A wrapper for Test::More's like(), that also emits more diagnostics on failure.
$trapper->field_unlike($what, $regex, $msg)
A wrapper for unlike().
$trapper->field_is($what, $expected, $msg)
A wrapper for is().
$trapper->field_is_deeply($what, $expected, $msg)
A wrapper for is_deeply().
my $got = Test::Run::Trap::Obj->trap_run({class => $class, args => \@args, run_func => $func})
Runs $class-
$func()> with the arguments @args placed into a hash-ref, traps the results and returns a results object.
AUTHOR
Shlomi Fish, http://www.shlomifish.org/.
LICENSE
This file is licensed under the MIT X11 License:
http://www.opensource.org/licenses/mit-license.php
SEE ALSO
Test::Trap , Test::More .