File Coverage

blib/lib/Test2/Formatter/T2Harness.pm
Criterion Covered Total %
statement 21 25 84.0
branch 4 6 66.6
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 28 35 80.0


line stmt bran cond sub pod time code
1             package Test2::Formatter::T2Harness;
2 2     2   202021 use strict;
  2         4  
  2         43  
3 2     2   7 use warnings;
  2         3  
  2         337  
4              
5             our $VERSION = '0.000012';
6              
7             sub new {
8 4     4 0 13195 my $class = shift;
9              
10 4         5 $| = 1;
11 4         10 my $orig = select STDERR;
12 4         5 $| = 1;
13 4         7 select STDOUT;
14 4         5 $| = 1;
15 4         7 select $orig;
16              
17 4 100       13 if ($INC{'Test/Builder.pm'}) {
18 2         6 print "# Selecting Test::Builder::Formatter.\n";
19 2 50       2 eval { require Test::Builder::Formatter; 1 } and return Test::Builder::Formatter->new(@_);
  2         31  
  2         18  
20              
21 0         0 die "Test::Builder is loaded, but Test::Builder::Formatter is not present.\nAre you trying to combine old Test::Builder with Test2?\n";
22             }
23              
24 2 50       6 if (-t STDOUT) {
25 0         0 print "# Selecting Test2::Formatter::TAP.\n";
26 0         0 require Test2::Formatter::TAP;
27 0         0 return Test2::Formatter::TAP->new(@_);
28             }
29              
30             # This formatter announces itself, no need to print it.
31 2         689 require Test2::Formatter::EventStream;
32 2         12 return Test2::Formatter::EventStream->new(@_);
33             }
34              
35             1;
36              
37             __END__