| 1 | package TAP::DOM::Waivers::Formatter::Session; | ||||||||||||
| 2 | BEGIN { | ||||||||||||
| 3 | 2 | ▶ | $TAP::DOM::Waivers::Formatter::Session::AUTHORITY = 'cpan:SCHWIGON'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | } # better TAP::Formatter::DOM::Session? | ||||||||||||
| 5 | # ABSTRACT: (incomplete) 'prove' plugin support for TAP::DOM::Waivers | ||||||||||||
| 6 | 2 | $TAP::DOM::Waivers::Formatter::Session::VERSION = '0.002'; | |||||||||||
| 7 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 2 | ▶ | use base qw( TAP::Base ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 2 | ▶ | use accessors qw( test formatter parser results html_id meta closed taplines ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 2 | ▶ | use YAML::Any; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 2 | ▶ | use TAP::DOM; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 2 | ▶ | use TAP::DOM::Waivers 'waive'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 2 | ▶ | use File::Temp 'tempfile'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | sub _slurp { | ||||||||||||
| 19 | 0 | ▶ | my ($filename) = @_; | ||||||||||
|
Subroutine
_slurp: not called CC=2 SCAR=17.9
| |||||||||||||
| 20 | |||||||||||||
| 21 | 0 | local $/; | |||||||||||
| 22 | 0 | ▶ | open (my $F, "<", $filename) or die "Cannot read $filename"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 0 | return <$F>; | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | sub _initialize { | ||||||||||||
| 27 | 0 | ▶ | my ($self, $args) = @_; | ||||||||||
|
Subroutine
_initialize: not called CC=4 SCAR=30.0
| |||||||||||||
| 28 | |||||||||||||
| 29 | 0 | ▶ | $args ||= {}; | ||||||||||
|
Condition0%0/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table0%0/2
A
A= $args
| |||||||||||||
| 30 | 0 | $self->SUPER::_initialize($args); | |||||||||||
| 31 | |||||||||||||
| 32 | 0 | $self | |||||||||||
| 33 | ->results([]) | ||||||||||||
| 34 | ->meta({}) | ||||||||||||
| 35 | ->closed(0) | ||||||||||||
| 36 | ->taplines([]) | ||||||||||||
| 37 | ; | ||||||||||||
| 38 | 0 | foreach my $arg (qw( test parser formatter )) { | |||||||||||
| 39 | 0 | ▶ | $self->$arg($args->{$arg}) if defined $args->{$arg}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 0 | $self->info( "INITIALIZE: " . $self->test . ':' ); | |||||||||||
| 43 | |||||||||||||
| 44 | 0 | return $self; | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | sub result { | ||||||||||||
| 48 | 0 | ▶ | my ($self, $result) = @_; | ||||||||||
|
Subroutine
result: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 49 | |||||||||||||
| 50 | 0 | push @{$self->taplines}, $result->raw; | |||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | # Called by TAP::?? to indicate there are no more test results coming | ||||||||||||
| 54 | sub close_test { | ||||||||||||
| 55 | 0 | ▶ | my ($self, @args) = @_; | ||||||||||
|
Subroutine
close_test: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 56 | |||||||||||||
| 57 | 0 | $self->info( "CLOSE" ); | |||||||||||
| 58 | |||||||||||||
| 59 | 0 | $self->info( $_ ) foreach @{$self->taplines}; | |||||||||||
| 60 | |||||||||||||
| 61 | 0 | my ($FH_tmptap, $tmptap) = tempfile(); | |||||||||||
| 62 | 0 | my $waiverfile = $self->formatter->waiver; | |||||||||||
| 63 | 0 | my $tapfile = $self->test; | |||||||||||
| 64 | 0 | my $waivers = YAML::Any::Load(_slurp($waiverfile)); | |||||||||||
| 65 | 0 | my $tapdom = TAP::DOM->new(tap => _slurp($tapfile)); | |||||||||||
| 66 | 0 | my $patched_tapdom = waive($tapdom, $waivers); | |||||||||||
| 67 | 0 | $self->info( "*** PATCHED_TAP: ".$patched_tapdom->to_tap ); | |||||||||||
| 68 | |||||||||||||
| 69 | 0 | $self->closed(1); | |||||||||||
| 70 | 0 | return; | |||||||||||
| 71 | } | ||||||||||||
| 72 | |||||||||||||
| 73 | sub as_report { | ||||||||||||
| 74 | 0 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
as_report: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 75 | 0 | my $p = $self->parser; | |||||||||||
| 76 | 0 | my $r = { | |||||||||||
| 77 | test => $self->test, | ||||||||||||
| 78 | results => $self->results, | ||||||||||||
| 79 | AFFE => "ZOMTEC", | ||||||||||||
| 80 | }; | ||||||||||||
| 81 | |||||||||||||
| 82 | 0 | $self->info( "AS_REPORT" ); | |||||||||||
| 83 | |||||||||||||
| 84 | 0 | return $r; | |||||||||||
| 85 | } | ||||||||||||
| 86 | |||||||||||||
| 87 | sub log { | ||||||||||||
| 88 | 0 | ▶ | my ($self, @args) = @_; | ||||||||||
|
Subroutine
log: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 89 | 0 | $self->formatter->log_test(@args); | |||||||||||
| 90 | } | ||||||||||||
| 91 | |||||||||||||
| 92 | sub info { | ||||||||||||
| 93 | 0 | ▶ | my ($self, @args) = @_; | ||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 94 | 0 | $self->formatter->log_test_info(@args); | |||||||||||
| 95 | } | ||||||||||||
| 96 | |||||||||||||
| 97 | 2 | 1; | |||||||||||
| 98 | |||||||||||||
| 99 | __END__ | ||||||||||||