lib/Test/Tester/CaptureRunner.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 5 totaltotal 85.0% 34 / 40 CC 3 SCAR 5.1
CC
3
Cov
96%
get_results
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Test2/AsyncSubtest/Event/Detach.pm ↑ Summary blib/lib/Test2/Event/Fail.pm »
1 # $Header: /home/fergal/my/cvs/Test-Tester/lib/Test/Tester/CaptureRunner.pm,v 1.3 2003/03/05 01:07:55 fergal Exp $
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Test::Tester::CaptureRunner;
5  
6 6 our $VERSION = '1.302226';
7  
8  
9 6 ▶use Test::Tester::Capture;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 require Exporter;
11  
12 sub new
13 6 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 6 my $pkg = shift;
15 6 my $self = bless {}, $pkg;
16 6 return $self;
17 }
18  
19 sub run_tests
20 18 ▶{
Subroutine run_tests: called CC=1 SCAR=0.0
Pod undocumented
21 18 my $self = shift;
22  
23 18 my $test = shift;
24  
25 18 capture()->reset;
26  
27 18 $self->{StartLevel} = $Test::Builder::Level;
28 18 &$test();
29 }
30  
31 sub get_results
32 18 ▶{
Subroutine get_results: called CC=3 SCAR=11.0
Pod undocumented
33 18 my $self = shift;
34 18 my @results = capture()->details;
35  
36 18 my $start = $self->{StartLevel};
37 18 foreach my $res (@results)
38 {
39 26 ▶ next if defined $res->{depth};
Branch: 1 branch
BranchTrueFalseTotal
if defined $res->{"depth"} 0 26 26
40 26 my $depth = $res->{_depth} - $res->{_level} - $start - 3;
41 # print "my $depth = $res->{_depth} - $res->{_level} - $start - 1\n";
42 26 $res->{depth} = $depth;
43 }
44  
45 18 return @results;
46 }
47  
48 sub get_premature
49 18 ▶{
Subroutine get_premature: called CC=1 SCAR=0.0
Pod undocumented
50 18 return capture()->premature;
51 }
52  
53 sub capture
54 54 ▶{
Subroutine capture: called CC=1 SCAR=0.0
Pod undocumented
55 54 return Test::Tester::Capture->new;
56 }
57  
58 __END__
« blib/lib/Test2/AsyncSubtest/Event/Detach.pm ↑ Summary blib/lib/Test2/Event/Fail.pm »