1Test::Run::Trap::Obj(3)User Contributed Perl DocumentatioTnest::Run::Trap::Obj(3)
2
3
4
6 Test::Run::Trap::Obj - wrapper around Test::Trap for trapping errors.
7
9 my $got = Test::Run::Trap::Obj->trap_run({
10 args => [test_files => ["t/sample-tests/simple"]]
11 });
12
13 $got->field_like("stdout", qr/All tests successful/,
14 "Everything is OK."
15 );
16
18 This class implements a wrapper around Test::Trap. When an assertion
19 files, the diagnostics prints all the relevant and trapped fields for
20 easy debugging.
21
23 $trapper->diag_all()
24 Calls Test::More's diag() with all the trapped fields, like stdout,
25 stderr, etc.
26
27 $trapper->field_like($what, $regex, $message)
28 A wrapper for Test::More's like(), that also emits more diagnostics on
29 failure.
30
31 $trapper->field_unlike($what, $regex, $msg)
32 A wrapper for unlike().
33
34 $trapper->field_is($what, $expected, $msg)
35 A wrapper for is().
36
37 $trapper->field_is_deeply($what, $expected, $msg)
38 A wrapper for is_deeply().
39
40 my $got = Test::Run::Trap::Obj->trap_run({class => $class, args => \@args,
41 run_func => $func})
42 Runs "$class-"$func()> with the arguments @args placed into a hash-ref,
43 traps the results and returns a results object.
44
46 Shlomi Fish, <http://www.shlomifish.org/>.
47
49 This file is licensed under the MIT X11 License:
50
51 http://www.opensource.org/licenses/mit-license.php
52
54 Test::Trap , Test::More .
55
56
57
58perl v5.30.1 2020-01-30 Test::Run::Trap::Obj(3)