App/Prove/Plugin/HTML.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 90.4% 38 / 42 CC 5 SCAR 12.0
CC
5
Cov
94%
load
5.0
import
2.0
BEGIN
1.0
CRAP 3.3
« TAP/Formatter/HTML.pm ↑ Summary
1 package App::Prove::Plugin::HTML;
2  
3 =head1 NAME
4  
5 App::Prove::Plugin::HTML - a prove plugin for HTML output
6  
7 =head1 SYNOPSIS
8  
9 # command-line usage:
10 prove -m -P HTML=outfile:out.html,css_uri:style.css,js_uri:foo.js,force_inline_css:0
11  
12 # NOTE: this is currently in alpha, this usage will likely change!
13  
14 =cut
15  
16 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 ▶use TAP::Formatter::HTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 our $VERSION = '0.13';
22  
23 0 ▶sub import {
Subroutine import: not called CC=1 SCAR=6.9
24 0 my ($class, @args) = @_;
25 # deprecated, do nothing
26 0 return $class;
27 }
28  
29 1 ▶sub load {
Subroutine load: called CC=5 SCAR=16.1
Pod undocumented
30 1 my ($class, $p) = @_;
31 1 my @args = @{ $p->{args} };
32 1 my $app = $p->{app_prove};
33  
34 # parse the args
35 1 my %TFH_args;
36 1 foreach my $arg (@args) {
37 7 my ($key, $val) = split(/:/, $arg, 2);
38 7 ▶ if (grep {$key eq $_} qw(css_uri js_uri)) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$key eq $_;} 'css_uri', 'js_uri') { } 4 3 7
39 4 push @{ $TFH_args{$key . 's'}}, $val;
40 } else {
41 3 $TFH_args{$key} = $val;
42 }
43 }
44  
45 # set the formatter to use
46 1 $app->formatter( 'TAP::Formatter::HTML' );
47  
48 # set ENV vars in order to pass args to TAP::Formatter::HTML
49 # horrible, but it's currently the only way :-/
50 1 ▶ while (my ($key, $val) = each %TFH_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %TFH_args) 5 1 6
51 5 ▶ $val = join( ':', @$val ) if (ref($val) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $val eq "ARRAY" 2 3 5
52 5 $ENV{"TAP_FORMATTER_HTML_".uc($key)} = $val;
53 }
54  
55 # we're done
56 1 return $class;
57 }
58  
59  
60 1 1;
61  
62 __END__
« TAP/Formatter/HTML.pm ↑ Summary